OnAxisKey

From Onset Developer Wiki
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