Get number of players in area

Hello, im trying to get number of players near the player that started the event (in radius) but i have no idea how to start it, what native to use. Any ideas? Or number of peds in area.

Checkout something like this, should get you started

local players = {}
local ptable = GetActivePlayers()
for _, i in ipairs(ptable) do
    local ped = GetPlayerPed(i)
    if (Vdist(GetEntityCoords(ped), coordsx, coordsy, coordsz) < radius) then
        table.insert(players, i)
    end
end
3 Likes

works like i wanted thank you :slight_smile:

im trying to get number of players in area can you help me pls