-
Notifications
You must be signed in to change notification settings - Fork 6
/
commands.lua
45 lines (39 loc) · 1.05 KB
/
commands.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
if Commands == nil then
Commands = class({})
end
function Commands:Init()
self.inited = true
self.help = [[
=== xctf 7th dotaxctf ===
x rr - restart the round
x fr - full restart
=== xctf 7th dotaxctf ===
]]
Convars:RegisterCommand("x", Commands_Main, Commands.help, FCVAR_SPONLY)
end
function Commands_Main(command, operation)
if operation ~= "rr" and operation ~= "fr" then
print(Commands.help)
return
end
if operation == "rr" then
Commands:RoundRestart()
elseif operation == "fr" then
Commands:FullRestart()
end
end
function Commands:FullRestart()
Timers:RemoveTimer("round_periodic_timer")
Timers:RemoveTimer("round_limit_timer")
Sandbox:CleanUpItems()
Rounds.restarting = true
Rounds:InitFromServerAndBeginGame()
end
function Commands:RoundRestart()
Timers:RemoveTimer("round_periodic_timer")
Timers:RemoveTimer("round_limit_timer")
Sandbox:CleanUpItems()
Rounds:PrepareBeginRound()
end
if not Commands.inited then Commands:Init() end
GameRules.Commands = Commands