addKeyBind

Creates a new keybind that executes a command when pressed, or re-enables an existing disabled keybind.

Parameters:

  • key (string): The keyboard key to bind (e.g., 'F1', 'E', 'SPACE', 'LSHIFT')

  • command (string): The command to execute when the key is pressed

Returns:

  • None

Behavior:

  • If keybind doesn't exist: Creates new keybind with command and key mapping

  • If keybind exists but is disabled: Re-enables the existing keybind

  • If keybind exists and is active: Shows debug message and does nothing

Example:

-- Basic keybind
ps.addKeybind('F1', 'openMenu')

-- Vehicle interaction keybind
ps.addKeybind('Y', 'car:engine')

-- Inventory keybind
ps.addKeybind('TAB', 'inventory:open')

-- Job-specific keybind
ps.addKeybind('F6', 'police:mdt')

Last updated