onVehicleExplode | Multi Theft Auto: Wiki Skip to content

onVehicleExplode

Client-side
Server-side
Shared

This event is triggered when a vehicle explodes.

This event can not be canceled.

Parameters

bool withExplosion, player player
  • withExplosion: Determines whether the vehicle was blown with or without an explosion.
  • player: The player who sent the explosion packet.

Source

element: The source of this event is the vehicle that exploded.

Code Examples

server

Example 1

local vagosVehicle = nil
-- This will get called when the vagos vehicle explodes
function onVagosVehicleExplode ()
outputChatBox ( "VAGOS VEHICLE DESTROYED!" )
end
-- This is called when THIS resource starts
function onThisResourceStart ()
-- Create the vagos vehicle. A van.
vagosVehicle = createVehicle ( 522, 0, 0, 5 )
-- Add its explode handler. When this car explodes, onVagosVehicleExplode is called
addEventHandler ( "onVehicleExplode", vagosVehicle, onVagosVehicleExplode )
end
--Add the resource start event
addEventHandler ( "onResourceStart", resourceRoot, onThisResourceStart )

See Also

Vehicle Functions