Files
ND_Core/client/functions.lua
Andyyy7666 9a9fa03e8a Revert "a lot of changes"
This reverts commit bf9604e851.
2023-07-10 02:37:54 +02:00

20 lines
662 B
Lua

function NDCore.GetPlayersFromCoords(distance, coords)
if coords then
coords = type(coords) == "table" and vec3(coords.x, coords.y, coords.z) or coords
else
coords = GetEntityCoords(PlayerPedId())
end
distance = distance or 5
local closePlayers = {}
local players = GetActivePlayers()
for _, player in ipairs(players) do
local target = GetPlayerPed(player)
local targetCoords = GetEntityCoords(target)
local targetdistance = #(targetCoords - coords)
if targetdistance <= distance then
closePlayers[#closePlayers + 1] = player
end
end
return closePlayers
end