IsEntityAtEntity
Docslocal retval = IsEntityAtEntity(entity1, entity2, xSize, ySize, zSize, p5, p6, p7)Description
Checks if entity1 is within the box defined by x/y/zSize of entity2.
Last three parameters are almost alwasy p5 = 0, p6 = 1, p7 = 0Parameters
| Name | Type | Description |
|---|---|---|
entity1 | Entity | — |
entity2 | Entity | — |
xSize | float | — |
ySize | float | — |
zSize | float | — |
p5 | BOOL | — |
p6 | BOOL | — |
p7 | int | — |
Quick Snippet: Get Entityentity1entity2
entity1entity2Use 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).