Keys::isUp

From RAGE Multiplayer Wiki
Revision as of 19:46, 27 November 2017 by Fright (talk | contribs) (Created page with "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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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).

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);

See also