OnActionKey

From Onset Developer Wiki
OnActionKey

Type: Event
Context: Client
Introduced: v1.5.5

Description

Called when the player pressed a specific key that is an "action". For example the space-bar for jumping.

Returning false in this function cancels the action.

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.

List of all ActionNames

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)

See also