forked from Not/srb2k-leaderboard
v1.2.4
This commit is contained in:
parent
321ff7737c
commit
9a1fb0677a
@ -108,25 +108,70 @@ local function initLeaderboard(player)
|
|||||||
end
|
end
|
||||||
addHook("PlayerSpawn", initLeaderboard)
|
addHook("PlayerSpawn", initLeaderboard)
|
||||||
|
|
||||||
local function retry(player, ...)
|
local function doyoudare(player)
|
||||||
if disable or player.spectator then
|
if disable or player.spectator then
|
||||||
CONS_Printf(player, "How dare you")
|
CONS_Printf(player, "How dare you")
|
||||||
return
|
return false
|
||||||
end
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local function retry(player, ...)
|
||||||
|
if doyoudare(player) then
|
||||||
COM_BufInsertText(server, "map " + G_BuildMapName(gamemap))
|
COM_BufInsertText(server, "map " + G_BuildMapName(gamemap))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
COM_AddCommand("retry", retry)
|
COM_AddCommand("retry", retry)
|
||||||
|
|
||||||
local function exitlevel(player, ...)
|
local function exitlevel(player, ...)
|
||||||
if disable or player.spectator then
|
if doyoudare(player) then
|
||||||
CONS_Printf(player, "How dare you")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
G_ExitLevel()
|
G_ExitLevel()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
COM_AddCommand("exit", exitlevel)
|
COM_AddCommand("exit", exitlevel)
|
||||||
|
|
||||||
|
local function mapNotExists(player, map)
|
||||||
|
CONS_Printf(player, string.format("Map doesn't exist: %s", map:upper()))
|
||||||
|
end
|
||||||
|
|
||||||
|
local ALPH = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
|
||||||
|
local function changelevel(player, ...)
|
||||||
|
if not doyoudare(player) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local map = ...
|
||||||
|
local p, q = map:upper():match("MAP(%w)(%w)$", 1)
|
||||||
|
if not (p and q) then
|
||||||
|
CONS_Printf(player, string.format("Invalid map name: %s", map))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local mapnum = 0
|
||||||
|
if tonumber(p) != nil then
|
||||||
|
-- Non extended map numbers
|
||||||
|
if tonumber(q) == nil then
|
||||||
|
mapNotExists(player, map)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
mapnum = tonumber(p) * 10 + tonumber(q)
|
||||||
|
else
|
||||||
|
--Extended map numbers
|
||||||
|
p = ALPH:find(p) - 1
|
||||||
|
q = (tonumber(q) or ALPH:find(q) + 10) - 1
|
||||||
|
mapnum = 36 * p + q + 100
|
||||||
|
end
|
||||||
|
|
||||||
|
if mapheaderinfo[mapnum] == nil then
|
||||||
|
mapNotExists(player, map)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
COM_BufInsertText(server, "map " + (G_BuildMapName(mapnum)))
|
||||||
|
end
|
||||||
|
COM_AddCommand("changelevel", changelevel)
|
||||||
|
|
||||||
local function clearcheats(player)
|
local function clearcheats(player)
|
||||||
if not player.spectator then
|
if not player.spectator then
|
||||||
clearcheats = true
|
clearcheats = true
|
||||||
|
Loading…
Reference in New Issue
Block a user