Key::bind

From RAGE Multiplayer Wiki
Revision as of 12:48, 15 January 2025 by Sander (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Client-Side
Function

 JavaScript



Description

This function binds the key.

Parameters

  • keycode - hexadecimal code of key.
  • keydown/keyup - true trigges on keydown, false triggers on keyup (bool)
  • handler - function-handler.

Example

This example calling server event.

/** binds F2 to this inline arrow function */
mp.keys.bind(0x71, true, () => {
	mp.gui.chat.push("F2 was pressed")
});

See also