DestroyElement: Difference between revisions
m (typo) |
|||
Line 16: | Line 16: | ||
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 (for example, clientside destroyElement can't destroy serverside elements). | 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 (for example, clientside destroyElement can't destroy serverside elements). | ||
14:36, 9 April 2013 (UTC)[[User:Yasserkajj alenzi|Yasserkajj alenzi]] | |||
Example : This Example get All Blibs and Destroy Them After Player Quit , | |||
'' | addEventHandler('onPlayerQuit', root, | ||
function (uPed ) | |||
function | local attachedElements = getAttachedElements(uPed) | ||
if attachedElements then | |||
for i, attachedElement in ipairs(attachedElements) do | |||
if(getElementType(attachedElements) == 'blip') then | |||
destroyElement(attachedElements) | |||
end | |||
end | |||
end | |||
end | end | ||
) | |||
This Exampel Made By Max+ | |||
==See Also== | ==See Also== | ||
{{Element functions}} | {{Element functions}} |
Revision as of 14:36, 9 April 2013
This function destroys an element and all elements within it in the hierarchy (its children, the children of those 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 destroyed, however, passing the root as an argument will wipe all elements from the server, except for the players and clients, which will become direct descendants of the root node, and other elements that cannot be destroyed, such as resource root elements.
Players are not the only elements that cannot be deleted. This list also includes remote clients and console elements.
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 (for example, clientside destroyElement can't destroy serverside elements).
14:36, 9 April 2013 (UTC)Yasserkajj alenzi Example : This Example get All Blibs and Destroy Them After Player Quit ,
addEventHandler('onPlayerQuit', root, function (uPed )
local attachedElements = getAttachedElements(uPed) if attachedElements then for i, attachedElement in ipairs(attachedElements) do if(getElementType(attachedElements) == 'blip') then destroyElement(attachedElements) end end end
end )
This Exampel Made By Max+
See Also
- attachElements
- createElement
- destroyElement
- detachElements
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByIndex
- getElementByID
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getAllElementData
- hasElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementType
- getElementVelocity
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementWithinColShape
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getPedContactElement
- getResourceDynamicElementRoot
- getResourceRootElement