shared
NetworkGetEntityFromNetworkId
FiveM shared native documentation with a Lua example.
Summary
Converts a network ID into a local entity handle, so a networked entity (like a spawned vehicle) can be referenced across clients and the server.
Returns
Entity (number) — the local handle for that network ID.
Parameters
netIdnumberThe network ID.Example
-- receiving a netId sent from another script
local veh = NetworkGetEntityFromNetworkId(netId)
if DoesEntityExist(veh) then
SetVehicleNumberPlateText(veh, 'SYNC1')
endCommon pitfalls
- The entity must have streamed in on this client, or the handle may be 0/invalid — check DoesEntityExist.
- Pair with NetworkGetNetworkIdFromEntity on the sending side.
Related natives
Related guides
Need protected areas on your map?
Viper Safe-Zone draws polygon safe zones in-game — no hand-edited coordinates — with weapon, combat and vehicle-speed rules per zone.
See Viper Safe-Zone →