update chatcommand

This commit is contained in:
HybridDog 2015-12-28 19:01:30 +01:00
parent 1e0bcbb709
commit 624cf7243d
1 changed files with 5 additions and 6 deletions

View File

@ -95,22 +95,21 @@ minetest.register_chatcommand("to_hell", {
description = "Send someone to hell", description = "Send someone to hell",
func = function(name, pname) func = function(name, pname)
if not minetest.check_player_privs(name, {nether=true}) then if not minetest.check_player_privs(name, {nether=true}) then
local self_player = minetest.get_player_by_name(name) local self_player,msg = minetest.get_player_by_name(name)
if self_player then if self_player then
minetest.chat_send_player(name, "You can't send anyone to hell, go to hell instead") msg = "You can't send anyone to hell, go to hell instead"
player_to_nether(self_player) player_to_nether(self_player)
else else
minetest.chat_send_player(name, "Something went wrong.") msg = "Something went wrong."
end end
return false return false, msg
end end
if not player_exists(pname) then if not player_exists(pname) then
pname = name pname = name
end end
local player = minetest.get_player_by_name(pname) local player = minetest.get_player_by_name(pname)
if not player then if not player then
minetest.chat_send_player(name, "Something went wrong.") return false, "Something went wrong."
return false
end end
minetest.chat_send_player(pname, "Go to hell !!!") minetest.chat_send_player(pname, "Go to hell !!!")
player_to_nether(player) player_to_nether(player)