]> git.lizzy.rs Git - Crafter.git/blobdiff - mods/too_many_items/init.lua
No cheat button when give privilegue is missing
[Crafter.git] / mods / too_many_items / init.lua
index b7997826a9151dfae94bda3f4ffa53b55eafc9ac..55961888ca20e0bf7bcc2b96c386cee2240266d6 100644 (file)
@@ -168,9 +168,11 @@ end
 
 local function cheat_button(name)
        if pool[name] and pool[name].cheating then
-               return("button[11.5,7.6;2,2;toomanyitems.cheat;cheat:on]")
+               return "button[11.5,7.6;2,2;toomanyitems.cheat;cheat:on]"
+       elseif minetest.check_player_privs(name, {give = true}) then
+               return "button[11.5,7.6;2,2;toomanyitems.cheat;cheat:off]"
        else
-               return("button[11.5,7.6;2,2;toomanyitems.cheat;cheat:off]")
+               return ""
        end
 end
 
@@ -369,4 +371,4 @@ local name
 minetest.register_on_leaveplayer(function(player)
        name = player:get_player_name()
        pool[name] = nil
-end)
\ No newline at end of file
+end)