restore kartencore to initial value

This commit is contained in:
Not 2022-04-18 20:51:18 +02:00
parent 1ab596ebeb
commit a1989d319b
1 changed files with 13 additions and 0 deletions

View File

@ -11,6 +11,7 @@ local prevLap = 0
local splits = {}
local PATCH = nil
local help = true
local EncoreInitial = nil
-- Tracks if stats have been written or not
local StatTrack = false
@ -310,6 +311,13 @@ local function initLeaderboard(player)
disable = disable or ingame() > 1
end
disable = $ or not cv_enable.value
-- Restore encore mode to initial value
if disable and EncoreInitial != nil then
COM_BufInsertText(server, string.format("kartencore %d", EncoreInitial))
EncoreInitial = nil
end
player.afkTime = leveltime
end
addHook("PlayerSpawn", initLeaderboard)
@ -426,6 +434,10 @@ local function toggleEncore(player)
end
local enc = CV_FindVar("kartencore")
if EncoreInitial == nil then
EncoreInitial = enc.value
end
if enc.value then
COM_BufInsertText(server, "kartencore off")
else
@ -1246,6 +1258,7 @@ local function netvars(net)
prevLap = net($)
drawState = net($)
StatTrack = net($)
EncoreInitial = net($)
lb = net($)
end
addHook("NetVars", netvars)