OnActionKey: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
{{FuncParam|ActionName|The name of the action. For example "Jump".}} | {{FuncParam|ActionName|The name of the action. For example "Jump".}} | ||
{{FuncParam|KeyName|The name of the key as a string.}} | {{FuncParam|KeyName|The name of the key as a string.}} | ||
List of all ActionNames | |||
[[File:ActionNames.PNG]] | |||
== Example == | == Example == |
Revision as of 19:16, 23 February 2022
Description
Called when the player pressed a specific key that is an "action". For example the space-bar for jumping.
Syntax
OnActionKey(EventType, ActionName, KeyName)
Parameters
- EventType
The input event of type EInputEvent - ActionName
The name of the action. For example "Jump". - KeyName
The name of the key as a string.
Example
function OnActionKey(EventType, ActionName, KeyName)
AddPlayerChat(ActionName)
if ActionName == "Jump" then
return false -- This will cancel the action. In this case the player is unable to jump.
end
end
AddEvent("OnActionKey", OnActionKey)