From 3573720c1db3e9364dc9dd20f49ca2f46aef058f Mon Sep 17 00:00:00 2001 From: Lunovox Heavenfinder Date: Sun, 17 May 2020 16:22:55 -0300 Subject: [PATCH] =?UTF-8?q?CORRE=C3=87=C3=83O=20DE=20BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * O comando '/checkstrongbox' estava bugando o servidor. --- commands.lua | 50 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/commands.lua b/commands.lua index ddf7873..35c7e1c 100644 --- a/commands.lua +++ b/commands.lua @@ -3,34 +3,42 @@ minetest.register_privilege("checkstrongbox", { give_to_singleplayer=false, }) -modMinerTrade.propCheckStrongBox = function(playername, param) +modMinerTrade.propCheckStrongBox = function(admname, param) return { params = "", description = modMinerTrade.translate("Lets you check the contents of another players strongbox."), - func = function(playername, param) - if minetest.get_player_privs(playername).checkstrongbox then - local targetname = string.match(param, "^([^ ]+)$") - if type(targetname)=="string" and targetname~="" then - if modMinerTrade.safe and modMinerTrade.safe[targetname] then - - local inv = modMinerTrade.getDetachedInventory(targetname) - minetest.show_formspec( - playername, - "safe_"..targetname, - modMinerTrade.getFormspec(targetname) - ) - return true + func = function(admname, param) + local player = minetest.get_player_by_name(admname) + if type(player)~="nil" and player:is_player() then --checha se o player que digitou o comando ainda esta online! + if minetest.get_player_privs(admname).checkstrongbox then + local targetname = string.match(param, "^([^ ]+)$") + if type(targetname)=="string" and targetname~="" then + if modMinerTrade.safe and modMinerTrade.safe[targetname] then + modMinerTrade.showInventory(player, targetname, + modMinerTrade.translate("INVENTORY OF '%s':"):format(targetname) + ) + return true + else + minetest.chat_send_player(admname, + core.colorize("#ff0000","[MINERTRADE:ERRO] ") + ..modMinerTrade.translate("The strongbox of %s was not created yet!"):format(dump(targetname)) + ) + end else - minetest.chat_send_player(playername, "[MINERTRADE:ERRO] "..modMinerTrade.translate("The strongbox of %s was not created yet!"):format(dump(targetname))) - end + minetest.chat_send_player(admname, + core.colorize("#ff0000","[MINERTRADE:ERRO] ") + .." /"..modMinerTrade.translate("checkstrongbox").." | "..modMinerTrade.translate("Lets you check the contents of another players strongbox.") + ) + end else - minetest.chat_send_player(playername, "[MINERTRADE:ERRO] /"..modMinerTrade.translate("checkstrongbox").." | "..modMinerTrade.translate("Lets you check the contents of another players strongbox.")) + minetest.chat_send_player(admname, + core.colorize("#ff0000","[MINERTRADE:ERRO] ") + ..modMinerTrade.translate("You do not have permission to run this command without the privileges 'checkstrongbox'!") + ) end - else - minetest.chat_send_player(playername, "[MINERTRADE:ERRO] "..modMinerTrade.translate("You do not have permission to run this command without the privileges 'checkstrongbox'!")) end return false - end, + end, --FIM DE: func = function(admname, param) } end @@ -39,6 +47,7 @@ minetest.register_chatcommand("csb", modMinerTrade.propCheckStrongBox()) --############################################################################################################### +--[[ minetest.register_chatcommand("minertrade", { params = "", description = "Exibe informações adicionais deste mod.", @@ -80,3 +89,4 @@ minetest.register_chatcommand("minertrade", { minetest.chat_send_player(name, name..", precione F10 e use a rolagem do mouse para ler todo este tutorial!!!", false) end, }) +--]]