Keys::unbind: Difference between revisions

From RAGE Multiplayer Wiki
(Add mp.keys.unbind)
 
Line 11: Line 11:


==Example==
==Example==
<div class="header" style="background-color: #AE4040; color: #FFFFFF; border: 2px solid #408DAE;">
{{ClientSide}}
<div style="margin: 10px 10px 10px 10px;"><b>Client-Side</b></div>
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
function checkKeyPressing() {
function checkKeyPressing() {
Line 25: Line 24:
}
}
</syntaxhighlight>
</syntaxhighlight>
</div>


==See also==
==See also==
{{KeyBinding_function_c}}
{{KeyBinding_function_c}}

Revision as of 23:29, 4 April 2018

This function unbinds the key.

Required Arguments

  • keycode - Code of key (Hexadecimal).
  • keyhold - Unbind the binds with keyhold-value.

Optional Arguments

  • handler - Only unbind this handler.

Keycodes can be found here

Example

Client-Side
function checkKeyPressing() {
    mp.gui.chat.push( "Pressing F2" );
}

function toggleTestMessageBind ( bool ) {
    if ( bool ) 
        mp.keys.bind( 0x71, true, checkKeyPressing );  //bind testMessage to F2
    else
        mp.keys.unbind( 0x71, true, checkKeyPressing );  //unbind it
}

See also