forked from Not/srb2k-leaderboard
set players afkTime before enabling antiAFK
This commit is contained in:
parent
23a8373230
commit
6c7cdf34b9
@ -83,11 +83,24 @@ local cv_gui = CV_RegisterVar({
|
||||
PossibleValue = {Off = GUI_OFF, Splits = GUI_SPLITS, On = GUI_ON}
|
||||
})
|
||||
|
||||
local cv_afk = CV_RegisterVar({
|
||||
local AntiAFK = true
|
||||
CV_RegisterVar({
|
||||
name = "lb_afk",
|
||||
defaultvalue = 1,
|
||||
flags = CV_NETVAR,
|
||||
PossibleValue = CV_OnOff
|
||||
flags = CV_NETVAR | CV_CALL,
|
||||
PossibleValue = CV_OnOff,
|
||||
func = function(v)
|
||||
-- Set players afkTime and toggle AntiAFK
|
||||
if v.value then
|
||||
for p in players.iterate do
|
||||
p.afkTime = leveltime
|
||||
end
|
||||
|
||||
AntiAFK = true
|
||||
else
|
||||
AntiAFK = false
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
local cv_enable = CV_RegisterVar({
|
||||
@ -1146,7 +1159,7 @@ local function think()
|
||||
end
|
||||
|
||||
if disable then
|
||||
if cv_afk.value then
|
||||
if AntiAFK 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
|
||||
|
Loading…
Reference in New Issue
Block a user