OnClientElementDestroy: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: {{Client event}} __NOTOC__ This event is triggered when an element gets destroyed by destroyElement or when the creator resource is stopping. It is also triggered when a parent elemen...)
 
mNo edit summary
Line 18: Line 18:
end)
end)
</syntaxhighlight>
</syntaxhighlight>
[[pl:onClientElementDestroy]]


==See Also==
==See Also==

Revision as of 19:50, 21 July 2016

This event is triggered when an element gets destroyed by destroyElement or when the creator resource is stopping. It is also triggered when a parent element of this element is destroyed.

Parameters

None

Source

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

Example

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")
	end
end)

See Also

Client element events


Client event functions