Difference between revisions of "ScriptHook.GetEntitiesInRange"
From Nomad DB
(Created page with "Returns a list of EntityId with entities around a given position & range. == Syntax == <syntaxhighlight lang="lua"> ScriptHook.GetEntitiesInRange(x, y, z, range) </syntax...") |
|||
Line 6: | Line 6: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | * '''x, y ,z''' number (Position) | + | * '''x, y, z''' number (Position) |
* '''range''' number (Range) | * '''range''' number (Range) | ||
Latest revision as of 11:43, 2 August 2020
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