GetEntityMapdataOwner
Docslocal retval, mapdataHandle, entityHandle = GetEntityMapdataOwner(entity)Description
Retrieves the map data and entity handles from a specific entity.
This function supports SDK infrastructure and is not intended to be used directly from your code.
Parameters
| Name | Type | Description |
|---|---|---|
entity | Entity | An entity owned by map data. |
mapdataHandle | int* | The output map data handle. |
entityHandle | int* | The output entity handle. |
Quick Snippet: Get Entityentity
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
BOOLReturns TRUE (1) or FALSE (0).