mirror of
https://github.com/a-bad-dev/simple-shooter-game.git
synced 2026-06-08 20:12:11 +00:00
Move chatcommands to a seperate mod
This commit is contained in:
parent
133480f8a2
commit
44c1be6a55
292 changed files with 50 additions and 45 deletions
46
mods/game/chatcommands/init.lua
Normal file
46
mods/game/chatcommands/init.lua
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
-- Chatcommands for SSG
|
||||
|
||||
core.register_chatcommand("load", {
|
||||
params = "<map>",
|
||||
privs = {match_manager = true},
|
||||
description = "Load a 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
|
||||
|
||||
map_data = place_map(param)
|
||||
|
||||
return true, "-!- Map loaded!"
|
||||
end
|
||||
})
|
||||
|
||||
core.register_chatcommand("start", {
|
||||
params = "",
|
||||
privs = {match_manager = true},
|
||||
description = "Start the match",
|
||||
func = function()
|
||||
start_match()
|
||||
return true, "-!- Match started!"
|
||||
end
|
||||
})
|
||||
|
||||
core.register_chatcommand("reset", {
|
||||
params = "",
|
||||
privs = {match_manager = true},
|
||||
description = "Terminate the match",
|
||||
func = function()
|
||||
if match_state ~= "pre_match" and 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
|
||||
})
|
||||
2
mods/game/chatcommands/mod.conf
Normal file
2
mods/game/chatcommands/mod.conf
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
name = chatcommands
|
||||
description = Chatcomands for Simple Shooter Game
|
||||
Loading…
Add table
Add a link
Reference in a new issue