Event: Script:OnInputKey
From Nomad DB
Revision as of 20:51, 4 May 2021 by Administrator (talk | contribs) (Created page with "This event is called everytime a Key is either pressed down or up. {{Warning|This event is only available in Legion ScriptHook version 1.1}} ==Usage== <syntaxhighlight lang="...")
This event is called everytime a Key is either pressed down or up.
This event is only available in Legion ScriptHook version 1.1
Usage
function script:OnInputKey(keyId, keyName, isDown)
if isDown then
print("Key " .. keyName .. " is down")
else
print("Key " .. keyName .. " is up")
end
end
Preventing Input
Optionally, you can return false to indicate that a certain key should not be processed by the game. The following example prevents the "W" key.
function script:OnInputKey(keyId, keyName, isDown)
if keyName == "W" then
return false
end
end