Skip to content

Input actions ​

dlmp.register_action ​

Declares an input action on every client. The player binds its key on the keys screen; default_key is only a suggestion: a key name ("A".."Z", "0".."9", "F1".."F12", "Space", "Enter", "Backspace", "Tab", "CapsLock", "PageUp", "PageDown", "Home", "End", "Insert", "Delete", "Left", "Up", "Right", "Down", "LeftShift", "RightShift", "LeftCtrl", "RightCtrl", "LeftAlt", "RightAlt"), optionally prefixed with any of Ctrl+, Shift+, Alt+ ("Ctrl+Z"; such a chord may use a key that the core or the game uses without modifiers), or nil for none. The server receives only player_action(player, name, pressed), never the key. The client suppresses the action while the player is typing or in a menu, but the server cannot verify this; the action also fires before spawn and while dead, so check the player before acting on it. Unregistering a held action fires its release; a disconnect does not, so clear a player's held actions on player_disconnect. If a client's controls already use the key, that client leaves the action unbound until the player binds a key. Fails with nil, err for a name that is not lowercase letters, digits and _ up to 32 bytes, a description over 64 bytes or longer than one line, an already declared name, more than 64 actions, or a default key used by the client (T, Y, Tab, F1, F5, F7, F8, F11, F12, Backspace), by the game's stock controls, by a platform action's stock key (K, L, G, even while that action is moved or off) or by another action. The calling resource owns the action until dlmp.unregister_action or until the resource stops.

Parameters

  • name string
  • description string
  • default_key (optional) string

Returns ok boolean|nil, err string|nil

dlmp.unregister_action ​

Removes an action declared by this resource from every client.

Parameters

  • name string

Returns ok boolean|nil, err string|nil

dlmp.set_platform_action_key ​

Changes the default key of a platform action or, with false, disables it for everyone. A key the player bound themselves is kept; a disabled action stays disabled. An unknown action or a key of the wrong type raises a Lua error; an unknown key name, a key dlmp.register_action would reject (the action's own stock key is always allowed) or an action whose key another resource holds fails with nil, err. The calling resource holds the key until dlmp.reset_platform_action_key or until the resource stops.

Parameters

  • action "engine"|"lights"|"passenger"
  • key string|false

Returns ok boolean|nil, err string|nil

dlmp.reset_platform_action_key ​

Restores a platform action's stock key (K, L, G) and releases it.

Parameters

  • action "engine"|"lights"|"passenger"

Returns ok boolean|nil, err string|nil

dlmp.show_action_prompt ​

Shows one player a prompt such as "[J] Sit" in the single prompt slot on the screen, replacing the previous one. The client inserts whichever key the player bound to the action; the press arrives through player_action like any other. If the client has no key bound to the action, the prompt says so. Repeating the same action and text sends nothing, so a script may call this every tick. Death does not hide the prompt. It is removed by dlmp.hide_action_prompt, when the action is removed, or when the resource that last wrote it stops. An undeclared action, or a text that is empty or over 64 bytes, fails with nil, err.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.hide_action_prompt ​

Parameters

Returns ok boolean|nil, err string|nil

Documentation licensed under CC BY 4.0. DarqlineMP is not affiliated with Rockstar Games or Take-Two Interactive. Grand Theft Auto is a trademark of Take-Two Interactive Software, Inc.