onClientElementDestroy | Multi Theft Auto: Wiki Skip to content

onClientElementDestroy

Client-side
Server-side
Shared

This event is triggered when an element gets destroyed by destroyElement or when the creator resource is stopping. It is also triggered when a children element of this element is destroyed. It is not triggered on a player when they quit.

Parameters

This event does not pass any parameters to the handler function.

Source

element: The source of this event is the element that is being destroyed.

Code Examples

client

This example prints a message in the chat box when the vehicle that you are in gets destroyed.

addEventHandler("onClientElementDestroy", root, function()
if getElementType(source) == "vehicle" and getPedOccupiedVehicle(localPlayer) == source then
outputChatBox("The vehicle that you were in has been destroyed by the script")
end
end)

See Also

Element Functions