From 1003e8288c2dba52562b05a56003982284d04ac3 Mon Sep 17 00:00:00 2001 From: HybridDog Date: Wed, 30 Dec 2015 11:16:58 +0100 Subject: [PATCH] dont send players to hell if they execute those chatcommands without nether priv --- nether/portal.lua | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/nether/portal.lua b/nether/portal.lua index 48dcea6..9d15667 100644 --- a/nether/portal.lua +++ b/nether/portal.lua @@ -91,18 +91,11 @@ end -- Chatcommands (edited) written by sss minetest.register_chatcommand("to_hell", { - params = "", + params = "[]", description = "Send someone to hell", func = function(name, pname) if not minetest.check_player_privs(name, {nether=true}) then - local self_player,msg = minetest.get_player_by_name(name) - if self_player then - msg = "You can't send anyone to hell, go to hell instead" - player_to_nether(self_player) - else - msg = "Something went wrong." - end - return false, msg + return false, "You need the nether priv to execute this chatcommand." end if not player_exists(pname) then pname = name @@ -113,37 +106,29 @@ minetest.register_chatcommand("to_hell", { end minetest.chat_send_player(pname, "Go to hell !!!") player_to_nether(player) - return true + return true, pname.." is now in the nether." end }) minetest.register_chatcommand("from_hell", { - params = "", + params = "[]", description = "Extract from hell", func = function(name, pname) if not minetest.check_player_privs(name, {nether=true}) then - local self_player = minetest.get_player_by_name(name) - if self_player then - minetest.chat_send_player(name, "You can't send anyone to hell, go to hell instead") - player_to_nether(self_player) - else - minetest.chat_send_player(name, "Something went wrong.") - end - return false + return false, "You need the nether priv to execute this chatcommand." end if not player_exists(pname) then pname = name end local player = minetest.get_player_by_name(pname) if not player then - minetest.chat_send_player(name, "Something went wrong.") - return false + return false, "Something went wrong." end minetest.chat_send_player(pname, "You are free now") player_from_nether(player) local pos = player:getpos() player:moveto({x=pos.x, y=100, z=pos.z}) - return true + return true, pname.." is now out of the nether." end })