getElementPosition
Type: Shared
Pair: setElementPosition
This function allows you to retrieve the position coordinates of an element. This can be any real world element, including:
- player
- vehicle
- object
- pickup
- marker
- [collision shapes](/collision shapes)
- blip
- [radar areas](/radar areas)
This example will print the player position to chat using /pos command.
function whatsMyPosition() -- get the position of local player local fX, fY, fZ = getElementPosition(localPlayer);
-- output it to chat outputChatBox("My current position is X: "..fX.." Y: "..fY.." Z: "..fZ);endaddCommandHandler("pos", whatsMyPosition);