OnVehicleExplode: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__
{{Server event}}
This event is triggered when a vehicle explodes.
This event is triggered when a vehicle explodes.


==Syntax==  
==Parameters==
<syntaxhighlight lang="lua">
No arguments
void onVehicleExplode ()
 
</syntaxhighlight>
==Source==
The [[event system#Event source|source]] of this event is the [[vehicle]] that exploded.


==Example==  
==Example==  
This example tells the players when a vehicle explodes
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function onVehicleExplode () --The function in which when a vehicle explodes
function onVehicleExplode () --The function in which when a vehicle explodes
Line 14: Line 15:
if ( VagosVehicleHealth == 0 ) then --If the vehicle's health is "0" (exploded)
if ( VagosVehicleHealth == 0 ) then --If the vehicle's health is "0" (exploded)
showTextForAll ( 3000, 0, 10, 125, 1.5, " VAGOS' LOAD HAS EXPLODED!" ) --shows the text
outputChatBox ( " VAGOS' LOAD HAS EXPLODED!" ) --shows the text
end
end
addEventHandler ( "onVehicleExplode", root, onVehicleExplode ) --Event is triggered
addEventHandler ( "onVehicleExplode", root, onVehicleExplode ) --Event is triggered
</syntaxhighlight>
</syntaxhighlight>
==See Also==
{{Event_functions}}

Revision as of 06:09, 30 December 2007

This event is triggered when a vehicle explodes.

Parameters

No arguments

Source

The source of this event is the vehicle that exploded.

Example

function onVehicleExplode () --The function in which when a vehicle explodes
	local VagosVehicleHealth = getVehicleHealth ( VagosVehicle ) --Gets the HP of the Vagos' vehicle
	
	if ( VagosVehicleHealth == 0 ) then --If the vehicle's health is "0" (exploded)
			outputChatBox ( " VAGOS' LOAD HAS EXPLODED!" ) --shows the text
end
addEventHandler ( "onVehicleExplode", root, onVehicleExplode ) --Event is triggered

See Also