diff --git a/leaderboard.lua b/leaderboard.lua index 4ee32d7..7239446 100644 --- a/leaderboard.lua +++ b/leaderboard.lua @@ -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