NetworkClient

networkGetEntityFromObjectId

NETWORK_GET_ENTITY_FROM_OBJECT_ID0x37D5F739FD494675

The GTA V native NETWORK_GET_ENTITY_FROM_OBJECT_ID of the NETWORK namespace, as LS:MP client scripts call it: the global function networkGetEntityFromObjectId, in JavaScript and in Lua.

SignatureJavaScript
networkGetEntityFromObjectId(p0: any): Entity
SignatureLua
networkGetEntityFromObjectId(p0: any): Entity

Usage

JavaScript
const entity = networkGetEntityFromObjectId(p0);
Lua
local entity = networkGetEntityFromObjectId(p0)

Parameters

ParameterTypeJavaScriptLua
p0Anyanyany

Returns

Entity JavaScript number, Lua integer

Game handle of an entity: a ped, a vehicle or an object. Not an LS:MP netId. Convert one with lsmp.getEntityFromNetId.

Notes

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

I've had this return the player's ped handle sometimes, but also other random entities.
Whatever p0 is, it's at least not synced to other players.
At least not all the time, some p0 values actually output the same entity, (different handle of course, but same entity).
But another p0 value may return an entity for player x, but not for player y (it'll just return -1 even if the entity exists on both clients).

Returns an entity handle or -1, value changes based on p0's value.

Reference

Namespace
Network NETWORK
In the game
Entity NETWORK_GET_ENTITY_FROM_OBJECT_ID(Any p0)
Hash
0x37D5F739FD494675
Introduced
Game build 505 legacy numbering

Open in the interactive natives reference