forked from Not/srb2k-leaderboard
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
70cd579079 | |||
e68ab38262 |
@ -9,6 +9,9 @@ local splits = {}
|
|||||||
local PATCH = nil
|
local PATCH = nil
|
||||||
local help = true
|
local help = true
|
||||||
|
|
||||||
|
-- Retry / changelevel map
|
||||||
|
local nextMap = nil
|
||||||
|
|
||||||
local Flags = 0
|
local Flags = 0
|
||||||
|
|
||||||
-- SPB flags with the least significance first
|
-- SPB flags with the least significance first
|
||||||
@ -99,11 +102,10 @@ local function allowJoin(v)
|
|||||||
local y
|
local y
|
||||||
if v then
|
if v then
|
||||||
y = "yes"
|
y = "yes"
|
||||||
--hud.enable("freeplay")
|
hud.enable("freeplay")
|
||||||
else
|
else
|
||||||
y = "no"
|
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
|
end
|
||||||
|
|
||||||
COM_BufInsertText(server, "allowteamchange " + y)
|
COM_BufInsertText(server, "allowteamchange " + y)
|
||||||
@ -140,10 +142,10 @@ end
|
|||||||
local function retry(player, ...)
|
local function retry(player, ...)
|
||||||
if doyoudare(player) then
|
if doyoudare(player) then
|
||||||
-- Prevents bind crash
|
-- Prevents bind crash
|
||||||
if leveltime < 15 then
|
if leveltime < 20 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
COM_BufInsertText(server, "map " + G_BuildMapName(gamemap))
|
nextMap = G_BuildMapName(gamemap)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
COM_AddCommand("retry", retry)
|
COM_AddCommand("retry", retry)
|
||||||
@ -165,7 +167,7 @@ local function changelevel(player, ...)
|
|||||||
if not doyoudare(player) then
|
if not doyoudare(player) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if leveltime < 15 then
|
if leveltime < 20 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -201,7 +203,7 @@ local function changelevel(player, ...)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
COM_BufInsertText(server, "map " + (G_BuildMapName(mapnum)))
|
nextMap = G_BuildMapName(mapnum)
|
||||||
end
|
end
|
||||||
COM_AddCommand("changelevel", changelevel)
|
COM_AddCommand("changelevel", changelevel)
|
||||||
|
|
||||||
@ -430,7 +432,7 @@ local function lbComp(a, b)
|
|||||||
-- if s is negative then b is harder
|
-- if s is negative then b is harder
|
||||||
-- if s is 0 then compare time
|
-- if s is 0 then compare time
|
||||||
local s = (a["flags"] & (F_SPBEXP | F_SPBBIG)) - (b["flags"] & (F_SPBEXP | F_SPBBIG))
|
local s = (a["flags"] & (F_SPBEXP | F_SPBBIG)) - (b["flags"] & (F_SPBEXP | F_SPBBIG))
|
||||||
return s > 0 or not(s < 0 or a["time"] > b["time"])
|
return s > 0 or not(s < 0 or a["time"] >= b["time"])
|
||||||
end
|
end
|
||||||
|
|
||||||
local function saveTime(player)
|
local function saveTime(player)
|
||||||
@ -502,7 +504,7 @@ end
|
|||||||
|
|
||||||
-- DEBUGGING
|
-- DEBUGGING
|
||||||
--local function saveLeaderboard(player, ...)
|
--local function saveLeaderboard(player, ...)
|
||||||
-- timeFinished = player.realtime
|
-- timeFinished = tonumber(... or player.realtime)
|
||||||
-- splits = {1000, 2000, 3000}
|
-- splits = {1000, 2000, 3000}
|
||||||
-- saveTime(player)
|
-- saveTime(player)
|
||||||
--end
|
--end
|
||||||
@ -525,6 +527,10 @@ local function getGamer()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function think()
|
local function think()
|
||||||
|
if nextMap then
|
||||||
|
COM_BufInsertText(server, "map " + nextMap)
|
||||||
|
nextMap = nil
|
||||||
|
end
|
||||||
|
|
||||||
if disable then
|
if disable then
|
||||||
if ingame() > 1 then
|
if ingame() > 1 then
|
||||||
@ -634,12 +640,16 @@ local function think()
|
|||||||
end
|
end
|
||||||
addHook("ThinkFrame", think)
|
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
|
if not CV_FindVar("allowteamchange").value then
|
||||||
allowJoin(true)
|
allowJoin(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
addHook("IntermissionThinker", resetTeamchange)
|
addHook("IntermissionThinker", interThink)
|
||||||
|
|
||||||
local function netvars(net)
|
local function netvars(net)
|
||||||
lb = net($)
|
lb = net($)
|
||||||
|
Reference in New Issue
Block a user