EntityClient

getEntityCoords

GET_ENTITY_COORDS0x3FEF770D40960D5A

The GTA V native GET_ENTITY_COORDS of the ENTITY namespace, as LS:MP client scripts call it: the global function getEntityCoords, in JavaScript and in Lua.

SignatureJavaScript
getEntityCoords(
  entity: Entity,
  alive: boolean
): { x: number, y: number, z: number }
SignatureLua
getEntityCoords(entity: Entity, alive: boolean): Vector3

Usage

JavaScript
const { x, y, z } = getEntityCoords(entity, alive);
Lua
local coords = getEntityCoords(entity, alive)
-- coords.x, coords.y, coords.z

Parameters

ParameterTypeJavaScriptLua
entityEntitynumberinteger
aliveBOOLbooleanboolean

Returns

Vector3 JavaScript { x: number, y: number, z: number }, Lua Vector3

A 3D vector. JavaScript gets a plain { x, y, z } object; Lua gets a real Vector3, with .x .y .z and arithmetic. As an argument, one vector fills three consecutive coordinates.

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

Gets the current coordinates for a specified entity.
entity = The entity to get the coordinates from.
alive = Unused by the game, potentially used by debug builds of GTA in order to assert whether or not an entity was alive.

Reference

Namespace
Entity ENTITY
In the game
Vector3 GET_ENTITY_COORDS(Entity entity, BOOL alive)
Hash
0x3FEF770D40960D5A

Open in the interactive natives reference