ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. getKeyState

Function

getKeyState

ClientInput and controlsIdentical to MTA:SA

Checks whether a key is held down right now. Works without bindKey too, e.g. in onClientRender.

Syntax

bool getKeyState(string key)

Arguments

keystring
The key, e.g. "lshift", "w", "mouse2".

Returns

true when the key is down.

Example

addEventHandler("onClientRender", root, function()
    if getKeyState("lalt") then
        dxDrawText("Trzymasz Alt", 20, 300)
    end
end)

See also