OnKeyPress: Difference between revisions
From Onset Developer Wiki
No edit summary |
mNo edit summary |
||
Line 21: | Line 21: | ||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{ | {{KeyClientEvents}} |
Latest revision as of 08:48, 16 January 2020
Description
Called when the player presses a key. You can use IsCtrlPressed and IsShiftPressed to check if it is a key combination.
Use OnKeyRelease to detect when they release the key.
Syntax
OnKeyPress(key)
Parameters
- key
The name of the key as a string.
Example
function OnKeyPress(key)
AddPlayerChat(key)
if key == "Tab" then
AddPlayerChat("You have pressed TAB!")
end
end
AddEvent("OnKeyPress", OnKeyPress)