onVehicleRespawn | Multi Theft Auto: Wiki Skip to content

onVehicleRespawn

Client-side
Server-side
Shared

This event is triggered when a vehicle is respawned due. See toggleVehicleRespawn.

Parameters

bool exploded
  • exploded: true if this vehicle respawned because it exploded, false if it respawned due to being deserted.

Source

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

Code Examples

server

This example shows a message in the chatbox, if it is respawned.

function onVehicleRespawn ( exploded )
-- Add this variable. It contains the vehicle name of the respawned vehicle
local vehicleName = getVehicleName ( source )
-- If it is exploded, echo a custom message
if ( exploded == true ) then
outputChatBox("A " .. vehiclename .. " has been respawned, after an explosion")
-- else echo a normal message
else
outputChatBox("A " .. vehiclename .. " has been respawned")
end
end
-- Add the Event Handler
addEventHandler ( "onVehicleRespawn", getRootElement(), onVehicleRespawn )

See Also

Vehicle Functions