DestroyElement: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 23: Line 23:


==See Also==
==See Also==
{{Element_Functions}}
{{Element functions}}

Revision as of 20:09, 20 May 2006

This function destroys an element, and all the elements within it in the hierarchy (i.e. it's children and their children etc). Player elements cannot be destroyed using this function. A player can only be removed from the hierarchy when they quit or are kicked.

Syntax

bool destroyElement ( element elementToDestroy )

Required Arguments

  • elementToDestroy: The element you wish to destroy.

Returns

Returns true if the element was destroyed successfully, false if either the element passed to it was invalid or it could not be destroyed for some other reason.

Example

This example would destroy every element in the map, with the exception of players and the root element itself.

-- Find the root element (the element that contains all others)
root = getRootElement ()
-- Destroy it and it's children.
destroyElement ( root )

See Also