DestroyElement

From Multi Theft Auto: Wiki
Revision as of 20:09, 20 May 2006 by Ransom (talk | contribs)
Jump to navigation Jump to search

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