client
NetworkGetNetworkIdFromEntity
FiveM client native documentation with a Lua example.
Summary
Converts a local entity handle to a network ID that can be sent to the server/other clients. Pairs with NetworkGetEntityFromNetworkId.
Returns
number — the network ID.
Parameters
entitynumberThe entity handle.Example
local netId = NetworkGetNetworkIdFromEntity(veh)
TriggerServerEvent('myscript:registerVeh', netId)Common pitfalls
- Entity handles are local; ALWAYS send netId across the network, not the raw handle.
- The entity must be networked.
Related natives
Related guides
FiveM scripts done right
Optimized, dual-framework scripts for QBCore and ESX from Viper Development — escrow protected, delivered instantly to your Cfx portal.
Browse Scripts →