NetworkClient

networkGetPlayerIndexFromPed

NETWORK_GET_PLAYER_INDEX_FROM_PED0x6C0E2E0125610278

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

SignatureJavaScript
networkGetPlayerIndexFromPed(ped: Ped): Player
SignatureLua
networkGetPlayerIndexFromPed(ped: Ped): Player

Usage

JavaScript
const player = networkGetPlayerIndexFromPed(ped);
Lua
local player = networkGetPlayerIndexFromPed(ped)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger

Returns

Player JavaScript number, Lua integer

The game's own player index: a local slot, as playerId() returns it. Not an LS:MP playerId.

Notes

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

Returns the Player associated to a given Ped when in an online session.

Reference

Namespace
Network NETWORK
In the game
Player NETWORK_GET_PLAYER_INDEX_FROM_PED(Ped ped)
Hash
0x6C0E2E0125610278

Open in the interactive natives reference