warn afk players 10 sec ahead

This commit is contained in:
Not 2022-04-19 13:02:01 +02:00
parent 45b785c654
commit 8de3423ef8

View File

@ -40,6 +40,7 @@ local clearcheats = false
local START_TIME = 6 * TICRATE + (3 * TICRATE / 4) + 1 local START_TIME = 6 * TICRATE + (3 * TICRATE / 4) + 1
local AFK_TIMEOUT = TICRATE * 5 local AFK_TIMEOUT = TICRATE * 5
local AFK_BALANCE = TICRATE * 60 local AFK_BALANCE = TICRATE * 60
local AFK_BALANCE_WARN = AFK_BALANCE - TICRATE * 10
local PREVENT_JOIN_TIME = START_TIME + TICRATE * 5 local PREVENT_JOIN_TIME = START_TIME + TICRATE * 5
local GUI_OFF = 0x0 local GUI_OFF = 0x0
@ -1108,6 +1109,12 @@ local function think()
if p.cmd.buttons then if p.cmd.buttons then
p.afkTime = leveltime p.afkTime = leveltime
end 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 if p.afkTime + AFK_BALANCE < leveltime then
p.spectator = true p.spectator = true
chatprint("\x89" + p.name + " was moved to the other team for game balance", true) chatprint("\x89" + p.name + " was moved to the other team for game balance", true)