Keys::isUp: Difference between revisions
MrPancakers (talk | contribs) m (Swapped from old template) |
mNo edit summary |
||
| (4 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
Function to check if specific key is released. | |||
== | ==Syntax== | ||
* '''keycode''' - code of the key | <pre>mp.keys.isUp(keyCode);</pre> | ||
===Required Argument=== | |||
* '''keycode''' - hexadecimal code of [https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731 key]. | |||
===Return Value=== | |||
* {{RageType|Boolean}} - <code>true</code> if the key specified is released, otherwise <code>false</code>. | |||
==Example== | ==Example== | ||
An interval that runs every | An interval that runs every 100ms and outputs the state of the key bound. (F2) | ||
{{ | {{ClientsideCode| | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
setInterval(() => { | setInterval(() => { | ||
mp.keys.isUp(0x71) | |||
? mp.gui.chat.push("false") | |||
: mp.gui.chat.push("true"); | |||
}, 100); | |||
}, | |||
</syntaxhighlight> | </syntaxhighlight> | ||
}} | |||
==See also== | ==See also== | ||
{{Keys_functions_c}} | {{Keys_functions_c}} | ||
[[Category:Control]] | |||
[[Category:Client-side Function]] | |||
Latest revision as of 12:55, 15 January 2025
Function to check if specific key is released.
Syntax
mp.keys.isUp(keyCode);
Required Argument
- keycode - hexadecimal code of key.
Return Value
- Boolean -
trueif the key specified is released, otherwisefalse.
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("false")
: mp.gui.chat.push("true");
}, 100);