mirror of
https://github.com/a-bad-dev/simple-shooter-game.git
synced 2026-06-08 20:12:11 +00:00
53 lines
No EOL
1.3 KiB
Lua
53 lines
No EOL
1.3 KiB
Lua
-- Chatcommands for SSG
|
|
|
|
core.register_chatcommand("start", {
|
|
params = "<map>",
|
|
privs = {match_manager = true},
|
|
description = "Start a match on <map>",
|
|
func = function(_, param)
|
|
if not param or param == "" then
|
|
return false, "-!- You must specify a map name!"
|
|
end
|
|
|
|
if match_state == "pre_match" or match_state == "post_match" or match_state == "in_progress" then
|
|
return false, "-!- Match is already in progress!"
|
|
end
|
|
|
|
local sucess = start_match(param)
|
|
|
|
if map_data == "nope :(" then
|
|
return false, "-!- Map not found!"
|
|
end
|
|
|
|
return true, "-!- Match started!"
|
|
end
|
|
})
|
|
|
|
core.register_chatcommand("stop", {
|
|
params = "",
|
|
privs = {match_manager = true},
|
|
description = "Terminate the match",
|
|
func = function()
|
|
if match_state ~= "post_match" and match_state ~= "not_started" then
|
|
core.chat_send_all(core.colorize("red", "Match terminated."))
|
|
end_match()
|
|
|
|
return true
|
|
end
|
|
|
|
return false, "Match cannot be terminated at the moment."
|
|
end
|
|
})
|
|
|
|
core.register_chatcommand("list_maps", {
|
|
params = "",
|
|
privs = {match_manager = true},
|
|
description = "List all maps",
|
|
func = function()
|
|
local list_string = "Available maps:\n"
|
|
for _, map in pairs(map_list) do
|
|
list_string = list_string .. map .. "\n"
|
|
end
|
|
return true, list_string .. "\nUse /start <map> to start a match."
|
|
end
|
|
}) |