how could i check for all players that exits from a sphere?
local SphereCenter = place you want sphere to be
local SphereRadius = distance you want in Source units
function PlayerLeftSphere(ply)
print(ply:Nick() .. " has left the sphere!")
end
function CheckSphere()
iterate through players
local pos = player's position
if (distance between SphereCenter and pos > SphereRadius) then
if (ply.InSphere) then
PlayerLeftSphere(ply)
end
ply.InSphere = false
else
ply.InSphere = true
end
end
end
hook.Add("Think", "ply in sphere", CheckSphere)
that’s really clever, thank you