Keys::isUp: Difference between revisions
No edit summary |
mNo edit summary |
||
| Line 4: | Line 4: | ||
<pre>mp.keys.isUp(keyCode);</pre> | <pre>mp.keys.isUp(keyCode);</pre> | ||
===Required | ===Required Argument=== | ||
* '''keyCode''': {{RageType|Number}} - [https://keycode.info code of the key]. | * '''keyCode''': {{RageType|Number}} - [https://keycode.info code of the key]. | ||
Revision as of 15:58, 14 May 2019
Function to check if specific key is released.
Syntax
mp.keys.isUp(keyCode);
Required Argument
- keyCode: Number - code of the key.
Return Value
- Boolean -
trueif the key specified is released, Otherwisefalse.
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(113) === true) { // 113 is the key code for F2
mp.gui.chat.push('F2 key is released!');
} else {
mp.gui.chat.push('F2 key is not released!');
}
}, 500);