NetworkClient

networkGetHostOfScript

NETWORK_GET_HOST_OF_SCRIPT0x1D6A14F1F9A736FC

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

SignatureJavaScript
networkGetHostOfScript(
  scriptName: string,
  instance_id: number,
  position_hash: number
): Player
SignatureLua
networkGetHostOfScript(
  scriptName: string,
  instance_id: integer,
  position_hash: integer
): Player

Usage

JavaScript
const player = networkGetHostOfScript(scriptName, instance_id, position_hash);
Lua
local player = networkGetHostOfScript(scriptName, instance_id, position_hash)

Parameters

ParameterTypeJavaScriptLua
scriptNamestringstringstring
instance_idintnumberinteger
position_hashintnumberinteger

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.

scriptName examples:
"freemode", "AM_CR_SecurityVan", ...

Most of the time, these values are used:
instance_id = -1
position_hash = 0

Reference

Namespace
Network NETWORK
In the game
Player NETWORK_GET_HOST_OF_SCRIPT(const char* scriptName, int instance_id, int position_hash)
Hash
0x1D6A14F1F9A736FC

Open in the interactive natives reference