SetEntityCoords
DocsSetEntityCoords(entity, xPos, yPos, zPos, alive, deadFlag, ragdollFlag, clearArea)Description
Sets the coordinates (world position) for a specified entity, offset by the radius of the entity on the Z axis.
This is the server-side RPC native equivalent of the client native [SET_ENTITY_COORDS](?\_0x06843DA7060A026B).
Parameters
| Name | Type | Description |
|---|---|---|
entity | Entity | The entity to change coordinates for. |
xPos | float | The X coordinate. |
yPos | float | The Y coordinate. |
zPos | float | The Z coordinate, ground level. |
alive | BOOL | Unused by the game, potentially used by debug builds of GTA in order to assert whether or not an entity was alive. |
deadFlag | BOOL | Whether to disable physics for dead peds, too, and not just living peds. |
ragdollFlag | BOOL | A special flag used for ragdolling peds. |
clearArea | BOOL | Whether to clear any entities in the target area. |
Quick Snippet: Get CoordinatesxPosyPoszPos
xPosyPoszPosAdd this command to your client script to retrieve precise locations in-game.
-- Add this to your client.lua. Type /pos in-game to copy coords.
RegisterCommand('pos', function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local heading = GetEntityHeading(ped)
local output = string.format("vector4(%.2f, %.2f, %.2f, %.2f)", coords.x, coords.y, coords.z, heading)
print(output)
TriggerEvent('chat:addMessage', { args = { '^4[COORD]^0', output } })
end)Quick Snippet: Get Entityentity
entityUse this to obtain an entity handle from the player's aim or crosshair.
-- Get the entity the player is aiming at
local ped = PlayerPedId()
local hit, entity = GetEntityPlayerIsFreeAimingAt(PlayerId())
if hit and entity ~= 0 then
print("Entity: " .. entity)
print("Model: " .. GetEntityModel(entity))
print("Type: " .. GetEntityType(entity)) -- 1=Ped, 2=Vehicle, 3=Object
endReturns
voidThis native does not return a value.