getNearestPlayerToEntity
GET_NEAREST_PLAYER_TO_ENTITY0x7196842CB375CDB3The GTA V native GET_NEAREST_PLAYER_TO_ENTITY of the ENTITY namespace, as LS:MP client scripts call it: the global function getNearestPlayerToEntity, in JavaScript and in Lua.
getNearestPlayerToEntity(entity: Entity): PlayergetNearestPlayerToEntity(entity: Entity): PlayerUsage
JavaScript
const player = getNearestPlayerToEntity(entity);Lua
local player = getNearestPlayerToEntity(entity)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
entity | Entity | number | integer |
Returns
Player JavaScript number, Lua integerThe game's own player index: a local slot, as playerId() returns it. Not an LS:MP playerId.
Reference
- Namespace
- Entity ENTITY
- In the game
Player GET_NEAREST_PLAYER_TO_ENTITY(Entity entity)- Hash
0x7196842CB375CDB3