GetEntityType
Docslocal retval = GetEntityType(entity)Description
Gets the entity type (as an integer), which can be one of the following defined down below:
The following entities will return type 1:
Ped
Player
Animal (Red Dead Redemption 2)
Horse (Red Dead Redemption 2)
The following entities will return type 2:
Automobile
Bike
Boat
Heli
Plane
Submarine
Trailer
Train
DraftVeh (Red Dead Redemption 2)
The following entities will return type 3:
Object
Door
Pickup
Otherwise, a value of 0 will be returned.
Parameters
| Name | Type | Description |
|---|---|---|
entity | Entity | The entity to get the type of. |
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
intReturns an integer value.