CloneElement

From Multi Theft Auto: Wiki
Revision as of 15:09, 19 June 2006 by MrJax (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This fake function is for cloning (creating an exact copy of) an already existing element.

Syntax

element cloneElement ( element theElement, [x, y, z ] )  

Required Arguments

  • theElement: The element that you wish to clone.

Optional Arguments

  • x: A floating point number representing the X coordinate on the map.
  • y: A floating point number representing the Y coordinate on the map.
  • z: A floating point number representing the Z coordinate on the map.

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

See Also

Template:Element Functions