ScriptHook.GetEntitiesInRange
From Nomad DB
Returns a list of EntityId with entities around a given position & range.
Syntax
ScriptHook.GetEntitiesInRange(x, y, z, range)
- x, y, z number (Position)
- range number (Range)
Example
Highlight all entities around the player position with a range of 20 units.
local entityId = GetLocalPlayerEntityId()
local xPos = GetEntityPosition(entityId, 0)
local yPos = GetEntityPosition(entityId, 1)
local zPos = GetEntityPosition(entityId, 2)
local outlineTable = ScriptHook.GetEntitiesInRange(xPos, yPos, zPos, 20)
for _,v in pairs(outlineTable) do
StartEntityHighlight(v, 4)
end