Client

addKeybind

fjsf.addKeybind(name, options, handler)

Registers a client-side keybind with press and release detection.

Internally uses the FiveM +command / -command pattern. The handler is called with true when the key is pressed and false when the key is released.


Parameters

  • name string Unique keybind name. Used to generate internal command names:

    • +<name> β†’ key pressed

    • -<name> β†’ key released Must be unique within the resource.

  • options table | nil Optional configuration table. Supported fields:

    • label string – Display name shown in keybind settings

    • defaultKey string – Primary default key (e.g. "E")

    • secondaryKey string – Secondary default key (optional)

  • handler function Callback function executed on key state change. Receives one argument:

    • isPressed boolean – true when pressed, false when released


Returns

This function does not return anything.


Example

Last updated