OnPlayerToggleAim: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Event|Client|1.2.0}} {{FuncDescription|Called when a (local) player presses the key to go in or out of the aim state. You can return '''false''' in this event to preve...")
 
No edit summary
 
Line 1: Line 1:
{{Info|Event|Client|1.2.0}}
{{Info|Event|Client|1.2.0}}


{{FuncDescription|Called when a (local) player presses the key to go in or out of the aim state. You can return '''false''' in this event to prevent the player from aiming.}}
{{FuncDescription|Called when a (local) player presses the key to go in or out of the aim state. You can return '''false''' in this event to prevent the player from aiming.
 
You can use [[CancelAimImmediately]] to stop the player from aiming if he is in aim state already.}}


{{FuncSyntax|OnPlayerToggleAim(toggle)}}
{{FuncSyntax|OnPlayerToggleAim(toggle)}}

Latest revision as of 09:11, 24 May 2020

OnPlayerToggleAim

Type: Event
Context: Client
Introduced: v1.2.0

Description

Called when a (local) player presses the key to go in or out of the aim state. You can return false in this event to prevent the player from aiming.

You can use CancelAimImmediately to stop the player from aiming if he is in aim state already.

Syntax

OnPlayerToggleAim(toggle)
  • toggle
    true if the player wants to aim, false otherwise.

Example

AddEvent("OnPlayerToggleAim", function(toggle)
    if toggle == true then
        return false -- do not allow the player to aim
    end
end)

See also