Difference between revisions of "Key::bind"

From RAGE Multiplayer Wiki
Jump to navigation Jump to search
(Add definition for unknown parameter "bool0".)
Line 3: Line 3:
 
==Parameters==
 
==Parameters==
 
* '''keycode''' - code of key (Int).
 
* '''keycode''' - code of key (Int).
* '''bool0''' - toggle of what? (Bool)
+
* '''keyhold''' - call function as long as key is held pressed? (Bool)
 
* '''handler''' - function-handler.
 
* '''handler''' - function-handler.
  

Revision as of 19:31, 27 November 2017

This function binds the key .

Parameters

  • keycode - code of key (Int).
  • keyhold - call function as long as key is held pressed? (Bool)
  • handler - function-handler.

Example

This example calling server event.

Client-Side
// 0x12 is a Alt keycode
mp.keys.bind(0x12,true,function(){
    mp.events.callRemote('keypress:Alt'); // Calling server event "keypress:Alt"
});

See also