ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. cloneElement

Function

cloneElement

ServerElementsIdentical to MTA:SA

Creates a copy of an element (vehicle, object, ped, marker and so on) at the given place.

Syntax

element cloneElement(element theElement [, float xPos = pozycja oryginału, float yPos = pozycja oryginału, float zPos = pozycja oryginału, bool cloneChildren = false])

Arguments

theElementelement
The element to copy.
xPosfloat, optional = pozycja oryginału
X position of the copy.
yPosfloat, optional = pozycja oryginału
Y position of the copy.
zPosfloat, optional = pozycja oryginału
Z position of the copy.
cloneChildrenbool, optional = false
Whether to copy children too.

Returns

The copy or false.

Example

addCommandHandler("kopia", function(player)
    local veh = getPedOccupiedVehicle(player)
    if veh then
        local x, y, z = getElementPosition(veh)
        cloneElement(veh, x + 5, y, z)
    end
end)