diff --git a/leaderboard.lua b/leaderboard.lua index 645c637..643f353 100644 --- a/leaderboard.lua +++ b/leaderboard.lua @@ -9,6 +9,9 @@ local splits = {} local PATCH = nil local help = true +-- Retry / changelevel map +local nextMap = nil + local Flags = 0 -- SPB flags with the least significance first @@ -99,11 +102,10 @@ local function allowJoin(v) local y if v then y = "yes" - --hud.enable("freeplay") + hud.enable("freeplay") else y = "no" - -- Why in gods name does this work on a local server but fails on a public one - --hud.disable("freeplay") + hud.disable("freeplay") end COM_BufInsertText(server, "allowteamchange " + y) @@ -140,10 +142,10 @@ end local function retry(player, ...) if doyoudare(player) then -- Prevents bind crash - if leveltime < 15 then + if leveltime < 20 then return end - COM_BufInsertText(server, "map " + G_BuildMapName(gamemap)) + nextMap = G_BuildMapName(gamemap) end end COM_AddCommand("retry", retry) @@ -165,7 +167,7 @@ local function changelevel(player, ...) if not doyoudare(player) then return end - if leveltime < 15 then + if leveltime < 20 then return end @@ -201,7 +203,7 @@ local function changelevel(player, ...) return end - COM_BufInsertText(server, "map " + (G_BuildMapName(mapnum))) + nextMap = G_BuildMapName(mapnum) end COM_AddCommand("changelevel", changelevel) @@ -525,6 +527,10 @@ local function getGamer() end local function think() + if nextMap then + COM_BufInsertText(server, "map " + nextMap) + nextMap = nil + end if disable then if ingame() > 1 then @@ -634,12 +640,16 @@ local function think() end addHook("ThinkFrame", think) -local function resetTeamchange() +local function interThink() + if nextMap then + COM_BufInsertText(server, "map " + nextMap) + nextMap = nil + end if not CV_FindVar("allowteamchange").value then allowJoin(true) end end -addHook("IntermissionThinker", resetTeamchange) +addHook("IntermissionThinker", interThink) local function netvars(net) lb = net($)