OnClientExplosion: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Update explosion types.)
 
(16 intermediate revisions by 13 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client event}}  
{{Client event}}
This event is triggered every time an explosion is created on the current clients scene (inside the streamer)
This event is triggered every time an explosion is created on the current '''clients scene''' (inside the streamer).
 
==Parameters==
==Parameters==
''None''
<syntaxhighlight lang="lua">
float x, float y, float z, int theType
</syntaxhighlight>
*'''x:''' X coordinate of where the explosion was created
*'''y:''' Y coordinate of where the explosion was created
*'''z:''' Z coordinate of where the explosion was created
*'''theType:''' the type of explosion created, see: [[Explosion types]]
==Source==
The [[event system#Event source|source]] of this event is the [[player]] who created the explosion.
If the explosion is from a [[vehicle]] the source is the [[player]] who syncs the vehicle.


==Source==
===Canceling===
The [[event system#Event source|source]] of this event is the explosions creator element (object/vehicle)
If this event is [[Event system #Canceling|canceled]], the explosion will not occur.


==Example==
==Example==
[[Category:Needs Example]]
This example outputs the type of element that created the explosion into the chatbox.
<syntaxhighlight lang="lua">
function onClientExplosion(x, y, z, theType)
outputChatBox("Explosion created by a "..getElementType(source))
end
addEventHandler("onClientExplosion", root, onClientExplosion)
</syntaxhighlight>


==See Also==
==See Also==
{{Event_functions}}
===Other client events===
{{Client_other_events}}
===Client event functions===
{{Client_event_functions}}

Latest revision as of 11:43, 11 January 2024

This event is triggered every time an explosion is created on the current clients scene (inside the streamer).

Parameters

float x, float y, float z, int theType
  • x: X coordinate of where the explosion was created
  • y: Y coordinate of where the explosion was created
  • z: Z coordinate of where the explosion was created
  • theType: the type of explosion created, see: Explosion types

Source

The source of this event is the player who created the explosion. If the explosion is from a vehicle the source is the player who syncs the vehicle.

Canceling

If this event is canceled, the explosion will not occur.

Example

This example outputs the type of element that created the explosion into the chatbox.

function onClientExplosion(x, y, z, theType)
	outputChatBox("Explosion created by a "..getElementType(source))
end
addEventHandler("onClientExplosion", root, onClientExplosion)

See Also

Other client events


Client event functions