DestroyElement

From Multi Theft Auto: Wiki
Revision as of 02:57, 16 August 2006 by Vandalite (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. The root element also cannot be destoryed; however, passing the root as an argument will wipe all elements from the map, except for the players, which will be placed as child elements just off the root node.

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