NetworkGetEntityFromNetworkId
Docslocal retval = NetworkGetEntityFromNetworkId(netId)Description
Get the local entity handle of the given network id
Through this native you can get back the entity that you previously converted to netid with NetworkGetNetworkIdFromEntity or with the ToNet natives
Parameters
| Name | Type | Description |
|---|---|---|
netId | int | the network id of the entity |
Quick Snippet: Get Entity→ Entity
→ EntityUse this to obtain an entity handle from the player's aim or crosshair.
-- Get the entity the player is aiming at
local ped = PlayerPedId()
local hit, entity = GetEntityPlayerIsFreeAimingAt(PlayerId())
if hit and entity ~= 0 then
print("Entity: " .. entity)
print("Model: " .. GetEntityModel(entity))
print("Type: " .. GetEntityType(entity)) -- 1=Ped, 2=Vehicle, 3=Object
endReturns
EntityReturns an entity handle.
Examples
Official
local entity = NetworkGetEntityFromNetworkId(netId)