Keys::isDown: Difference between revisions
MrPancakers (talk | contribs) m (Swapped from old template) |
MrPancakers (talk | contribs) m (Altered wording) |
||
| Line 1: | Line 1: | ||
Returns true if the key | Returns true if the key specified is pressed. Otherwise, returns false. | ||
==Parameters== | ==Parameters== | ||
Revision as of 02:27, 13 May 2018
Returns true if the key specified is 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.isDown(112) === true) { // 112 is the key code for F2
mp.gui.chat.push('F2 key is pressed!');
} else {
mp.gui.chat.push('F2 key is not pressed!');
}
}, 500);