Keys::isDown

From RAGE Multiplayer Wiki
Revision as of 12:56, 15 January 2025 by Sander (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Function to check if specific key is pressed down.

Syntax

mp.keys.isDown(keyCode);

Required Argument

  • keycode - hexadecimal code of key.

Return Value

  • Boolean - true if the key specified is pressed, Otherwise false.

Example

An interval that runs every 100ms and outputs the state of the key bound. (F2)

Client-Side
setInterval(() => {
	mp.keys.isUp(0x71)
		? mp.gui.chat.push("true")
		: mp.gui.chat.push("false");
}, 100);

See also