Keys::isUp: Difference between revisions
| Line 6: | Line 6: | ||
==Example== | ==Example== | ||
An interval that runs every half-second and outputs the state of the F2 key (pressed or not). | An interval that runs every half-second and outputs the state of the F2 key (pressed or not). | ||
{{ClientSide}} | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
setInterval(() => { | setInterval(() => { | ||
| Line 17: | Line 16: | ||
}, 500); | }, 500); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See also== | ==See also== | ||
{{KeyBinding_function_c}} | {{KeyBinding_function_c}} | ||
Revision as of 23:29, 4 April 2018
Returns true if the key specific is not pressed. Otherwise, returns false.
Parameters
- keycode - code of the key (Number).
Example
An interval that runs every half-second and outputs the state of the F2 key (pressed or not).
Client-Side
setInterval(() => {
if (mp.keys.isUp(112) === true) { // 112 is the key code for F2
mp.gui.chat.push('F2 key is not pressed!');
} else {
mp.gui.chat.push('F2 key is pressed!');
}
}, 500);