OnAxisKey

From Onset Developer Wiki
Revision as of 19:58, 23 February 2022 by BlueMountains (talk | contribs) (Created page with "{{Info|Event|Client|1.5.5}} {{FuncDescription|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.}} {{FuncSyntax|OnAxisKey(EventType, AxisName, KeyName)}} {{FuncParameters}} {{FuncParam|EventType|The input event of type EInputEvent}} {{FuncParam|AxisName|The name of the axis. For example "Brake" or "MoveForward".}} {{FuncParam|KeyName|The name of the key a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
OnAxisKey

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

OnAxisKey(EventType, AxisName, KeyName)

Parameters

  • EventType
    The input event of type EInputEvent
  • AxisName
    The name of the axis. For example "Brake" or "MoveForward".
  • KeyName
    The name of the key as a string.

List of all AxisNames

Example

function OnAxisKey(EventType, AxisName, KeyName)
	AddPlayerChat(AxisName)
	if ActionName == "Brake" then
		return false -- This will cancel the action. In this case the player is unable to brake with their car.
	end
end
AddEvent("OnAxisKey", OnAxisKey)

See also