Event: Script:OnInputKey

From Nomad DB
Revision as of 21:09, 17 July 2022 by Administrator (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This event is called everytime a Key is either pressed down or up.

This event is only available in Legion ScriptHook version 1.1 and later.

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

Related Pages