From a19631f41df7633b590eaebb4c317335de697c7c Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 8 Dec 2015 00:24:46 +0000 Subject: [PATCH] Add /ctf_respawn --- mods/ctf_match/chat.lua | 24 ++++++++++++++++++++++++ mods/ctf_match/depends.txt | 1 + 2 files changed, 25 insertions(+) diff --git a/mods/ctf_match/chat.lua b/mods/ctf_match/chat.lua index 1aea8aa..c6baf85 100644 --- a/mods/ctf_match/chat.lua +++ b/mods/ctf_match/chat.lua @@ -11,3 +11,27 @@ minetest.register_chatcommand("ctf_next", { ctf_match.next() end }) + +minetest.register_chatcommand("ctf_respawn", { + description = "Respawn a player (clean inv, send to base)", + privs = { + ctf_team_mgr = true + }, + func = function(name, param) + local tplayer = ctf.player_or_nil(param) + if tplayer then + local player = minetest.get_player_by_name(param) + if player then + ctf.move_to_spawn(param) + give_initial_stuff(player) + minetest.chat_send_player(param, + "You were sent back to base and your inventory wiped (by " .. name .. ")") + return true, "Moved player to spawn and wiped inventory." + else + return false, "Player is not online." + end + else + return false, "Player does not exist or is not in any teams." + end + end +}) diff --git a/mods/ctf_match/depends.txt b/mods/ctf_match/depends.txt index 7430160..b82802d 100644 --- a/mods/ctf_match/depends.txt +++ b/mods/ctf_match/depends.txt @@ -1,4 +1,5 @@ ctf ctf_flag +ctf_inventory vote hudkit