Skip to content

setElementPosition

Type: Shared

Pair: getElementPosition

This function sets the position of an element to the specified coordinates.

This example teleports the player to map center using /zero command. (aka. origin point)

setElementPosition-1.lua
function teleportPlayerToMapCenter()
-- teleport player to 0,0,0 coordinates (map origin/center)
setElementPosition(localPlayer, 0, 0, 0 + 3); -- add +3 to z coordinate to not fall below map!
end
addCommandHandler("zero", teleportPlayerToMapCenter);