getKeyState
Client
Tells whether a key is held down right now.
bool getKeyState(string key)
Parameters
| Name | Type | Description |
|---|---|---|
| key | string | The key's name, in any case: a to z, 0 to 9, F1 to F12, mouse1 to mouse5, mouse_wheel_up, mouse_wheel_down, arrow_l, num_0, space, enter, lshift and others. |
Returns
true if the key is down, false otherwise.
It reads the key itself, even when onClientKey was cancelled for it.
Example
addEventHandler("onClientRender", root, function()
if getKeyState("lshift") then
dxDrawText("Shift held", 20, 20)
end
end)