From Multi Theft Auto: Wiki
Revision as of 15:14, 9 November 2018 by Arran Fortuna (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.


No parameters.


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


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

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

See Also

Client element events

Client event functions