CloneElement
Jump to navigation
Jump to search
This function clones (creates an exact copy of) an already existing element. The root node, and player elements cannot be cloned.
Syntax
element cloneElement ( element theElement, [ float xOffset, float yOffset, float zOffset, bool cloneChildren=false ] )
Required Arguments
- theElement: The element that you wish to clone.
Optional Arguments
- xPos: A floating point number representing the offset from the cloned element's X coordinate on the map.
- yPos: A floating point number representing the offset from the cloned element's Y coordinate on the map.
- zPos: A floating point number representing the offset from the cloned element's Z coordinate on the map.
- cloneChildren: A boolean value representing whether or not the element's children will be cloned.
Returns
Returns the handle of the new cloned element of the parent.
Example
This example clones the vehicle a player is in.
if ( command == "clone" ) then x, y, z = getElementPosition ( source ) -- get the position of the player clone = cloneElement ( getPlayerOccupiedVehicle ( source ), 5, 0, 0 ) -- create a clone of the player's vehicle end
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