el admin puede cambiar las tiendas de otros

This commit is contained in:
GNU Hacker 2021-12-16 18:44:20 +01:00
parent cb6843565d
commit b7b7db4820

@ -46,7 +46,8 @@ function emeraldbank.get_shop_fs(pos, clicker)
local owner = meta:get_string("owner")
local player_press_key = clicker:get_player_control().aux1
local shop_fs = ""
if pname == owner and not player_press_key then
local is_admin = core.check_player_privs(pname, {server=true})
if (pname == owner or is_admin) and not player_press_key then
shop_fs = "size[9,8.75]"..
"label[0,0;"..S("Your stock:").."]"..
"list["..list_name..";stock;0,0.5;"..stock_w..","..stock_h..";]"..
@ -130,8 +131,9 @@ core.register_node("emeraldbank:shop", {
end,
on_rightclick = function(pos, node, clicker, itemstack)
local pname = clicker:get_player_name()
get_stonks(pos, clicker)
core.show_formspec(clicker:get_player_name(), formspec_prefix..core.pos_to_string(pos), emeraldbank.get_shop_fs(pos, clicker) )
core.show_formspec(pname, formspec_prefix..core.pos_to_string(pos), emeraldbank.get_shop_fs(pos, clicker) )
end,
on_punch = function(pos, node, puncher, pointed_thing)