OnAxisKey: Difference between revisions

From Onset Developer Wiki
(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...")
 
(No difference)

Latest revision as of 19:58, 23 February 2022

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