forked from Not/srb2k-leaderboard
Dont iterate players if afk is disabled
This commit is contained in:
parent
e3c870eefd
commit
5790a3c020
@ -1146,28 +1146,30 @@ local function think()
|
||||
end
|
||||
|
||||
if disable then
|
||||
if cv_afk.value and ingame() > 1 then
|
||||
for p in players.iterate do
|
||||
if p.valid and not p.spectator and not p.exiting and p.lives > 0 then
|
||||
if p.cmd.buttons then
|
||||
p.afkTime = leveltime
|
||||
end
|
||||
if cv_afk.value then
|
||||
if ingame() > 1 then
|
||||
for p in players.iterate do
|
||||
if p.valid and not p.spectator and not p.exiting and p.lives > 0 then
|
||||
if p.cmd.buttons then
|
||||
p.afkTime = leveltime
|
||||
end
|
||||
|
||||
--Away from kart
|
||||
if p.afkTime + AFK_BALANCE_WARN == leveltime then
|
||||
chatprintf(p, "[AFK] \x89You will be moved to spectator in 10 seconds!", false)
|
||||
S_StartSound(nil, 26, p)
|
||||
end
|
||||
if p.afkTime + AFK_BALANCE < leveltime then
|
||||
p.spectator = true
|
||||
chatprint("\x89" + p.name + " was moved to the other team for game balance", true)
|
||||
--Away from kart
|
||||
if p.afkTime + AFK_BALANCE_WARN == leveltime then
|
||||
chatprintf(p, "[AFK] \x89You will be moved to spectator in 10 seconds!", false)
|
||||
S_StartSound(nil, 26, p)
|
||||
end
|
||||
if p.afkTime + AFK_BALANCE < leveltime then
|
||||
p.spectator = true
|
||||
chatprint("\x89" + p.name + " was moved to the other team for game balance", true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
for p in players.iterate do
|
||||
if p.valid and not p.spectator then
|
||||
p.afkTime = leveltime
|
||||
else
|
||||
for p in players.iterate do
|
||||
if p.valid and not p.spectator then
|
||||
p.afkTime = leveltime
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user