CloneElement: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
element cloneElement ( element theElement, [ | element cloneElement ( element theElement, [ float xPos, float yPos, float zPos, bool cloneChildren ] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 11: | Line 11: | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
* ''' | * '''xPos''': A floating point number representing the X coordinate on the map. | ||
* ''' | * '''yPos''': A floating point number representing the Y coordinate on the map. | ||
* ''' | * '''zPos''': A floating point number representing the Z coordinate on the map. | ||
* '''cloneChildren''': A boolean value representing whether or not the element's children will be cloned. | |||
===Returns=== | ===Returns=== |
Revision as of 12:14, 12 July 2006
This fake function is for cloning (creating an exact copy of) an already existing element.
Syntax
element cloneElement ( element theElement, [ float xPos, float yPos, float zPos, bool cloneChildren ] )
Required Arguments
- theElement: The element that you wish to clone.
Optional Arguments
- xPos: A floating point number representing the X coordinate on the map.
- yPos: A floating point number representing the Y coordinate on the map.
- zPos: A floating point number representing the 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.
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 ), x + 5, y, z ) -- create a clone of the player's vehicle end