here’s something i use with this ^
function GetNearbyPeds(X, Y, Z, Radius)
local NearbyPeds = {}
if tonumber(X) and tonumber(Y) and tonumber(Z) then
if tonumber(Radius) then
for Ped in EnumeratePeds() do
if DoesEntityExist(Ped) then
local PedPosition = GetEntityCoords(Ped, false)
if Vdist(X, Y, Z, PedPosition.x, PedPosition.y, PedPosition.z) <= Radius then
table.insert(NearbyPeds, Ped)
end
end
end
else
Log.Warn("GetNearbyPeds was given an invalid radius!")
end
else
Log.Warn("GetNearbyPeds was given invalid coordinates!")
end
return NearbyPeds
end
1 Like