OnClientPlayerChoke: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Resolve check: theres no 'responsiblePed' argument)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client event}}
{{Client event}}
{{Needs_Checking|responsiblePed is always nil}}
This event is fired when the local player chokes due to the effect of a weapon such as tear gas grenades, fire extinguishers and spray cans.
{{Needs_Checking|Check it is only triggered for the local player and the source is correct}}
This event is fired when a player chokes due to the effect of a weapon such as tear gas grenades, fire extinguishers and spray cans.
==Parameters==
==Parameters==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
int weaponID, ped responsiblePed
int weaponID
</syntaxhighlight>
</syntaxhighlight>
*'''weapon:''' an [[int]] representing the ID of the [[weapon]] which caused the choking.
*'''weapon:''' an [[int]] representing the ID of the [[weapon]] which caused the choking.
*'''responsiblePed:''' the ped responsible for causing the choking, possiblly nil.
==Source==
==Source==
The source of this event is the player who is choking. (Local player only)
The source of this event is the player who is choking. (Local player only)
Line 21: Line 17:
This example disables choking effects from the tear gas grenades.
This example disables choking effects from the tear gas grenades.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function cancelTearGasChoking(weaponID, responsiblePed)
function cancelTearGasChoking(weaponID)
if (weaponID==17) then
if (weaponID==17) then
cancelEvent()
cancelEvent()

Latest revision as of 18:48, 17 July 2020

This event is fired when the local player chokes due to the effect of a weapon such as tear gas grenades, fire extinguishers and spray cans.

Parameters

int weaponID
  • weapon: an int representing the ID of the weapon which caused the choking.

Source

The source of this event is the player who is choking. (Local player only)

Cancel effect

If this event is canceled, the player will not be choked.

Example

Click to collapse [-]
Client

This example disables choking effects from the tear gas grenades.

function cancelTearGasChoking(weaponID)
	if (weaponID==17) then
		cancelEvent()
	end
end
addEventHandler("onClientPlayerChoke", getLocalPlayer(), cancelTearGasChoking)

See Also

Client player events


Client event functions