Interactive blocks
N.bind() allows you to easily bind actions to keys, with full support for:
β Custom key actions
β Engine/lock toggles
β Door control systems
β Zone-based key logic
β Cooldowns
β Animations and scenarios
β Teleportation to map marker
β Safe (error-protected) execution
This system makes your key interactions extremely simple and powerful.
πΉ Basic Syntax
N.bind({
key: "E",
description: "Interact with nearest object",
notify: "πΉ Interact key pressed",
cooldown: 2000, // 2s cooldown
action: (player) => {
mp.gui.chat.push("β
You pressed E!");
}
});β Automatically:
Binds the key
"E"Handles cooldown between presses
Shows notification if provided
Executes your callback safely
βοΈ Parameters
key
string
β
Main key to bind (e.g. "E", "F7", "L", "G").
engineKey
string
β
Binds a key to toggle vehicle engine (automatic logic).
lockKey
string
β
Binds a key to lock/unlock the current vehicle.
description
string
β
Description shown when key is registered.
notify
string
β
Chat notification when the key is pressed.
log
string
β
Console log message when triggered.
playAnim
object
null
{ dict, name } animation played on press.
playerScenario
string
null
GTA scenario name (e.g. "WORLD_HUMAN_SMOKING").
tpToMarker
boolean
false
Teleports player to map marker (calls remote event).
safe
boolean
false
Wraps the action in try/catch to prevent crashes.
doorControl
object / array
null
Opens/closes nearby doors based on config.
zone
object
null
{ pos, radius } β only triggers inside area.
cooldown
number
0
Time (ms) before key can be pressed again.
action
function
β
Function executed when the key is pressed.
π§© Example β Vehicle Engine Key
β Automatically toggles the playerβs vehicle engine:
Turns the engine on/off properly using
vehicle.setEngineOn()Prevents auto-starting when player enters
π§© Example β Vehicle Lock Key
β Toggles the vehicleβs lock state:
Uses vehicle variable
"locked"Safe for both driver and passengers
π§© Example β Door Control System
β Automatically:
Detects nearby door by distance
Sends access check to server if
checkerexistsToggles door open/close via
mp.game.object.doorControl()Plays optional notification or callback action
Server will respond using event:
π§© Example β Zone-Based Key
β Runs only when the player is inside the given radius.
π§© Example β Teleport to Marker
Automatically teleports the player to the map waypoint (via remote event).
π§© Example β Animation or Scenario Bind
Or use a scenario:
π§ Safe Mode & Cooldowns
All binds support safe mode and cooldowns:
β Prevents crashing the client and limits spam to once every 5 seconds.
π Internal Behavior
Internally, N.bind():
Converts key names to key codes via
mp.keys.getCodeFromName()Uses
mp.keys.bind(code, false, handler)Tracks per-key cooldowns
Supports multiple logic layers (door control, engine toggle, zone check, etc.)
Uses a unified
executeSafe()wrapper to handle:Logging
Animations/scenarios
Teleportation
Notifications
Exception safety
π§± Example: Combined Door + Zone + Animation
One key β animation + door control + safe checks + cooldowns. Thatβs the full power of NurJS bindings πͺ
N.bind() gives developers a unified and safe system for key interactions.
From teleportation and vehicle logic to door systems and animations β everything can be attached to a single key with a few lines of code.
Itβs the foundation for client gameplay interactivity in NurJS.
Last updated