Minetest mod that allows an admin (or anyone who has the "inv" priv) to check the inventories of other players.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

init.lua 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  1. -- Check Inventory
  2. minetest.register_privilege("inv", "Can use /inv")
  3. minetest.register_chatcommand("inv", {
  4. params = "<name>",
  5. description = "Shows inventory of <name>",
  6. func = function(name, param)
  7. if not minetest.check_player_privs(name, {inv=true}) then
  8. return false, "You don't have permission to check inventories"
  9. end
  10. local player = minetest.get_player_by_name(param)
  11. if player == nil then
  12. minetest.chat_send_player(name, param.." is not online right now")
  13. return false
  14. end
  15. local player_inv = player:get_inventory()
  16. local invlist = param.."'s inventory: "
  17. for i=1,player_inv:get_size("main") do
  18. local items = player_inv:get_stack("main", i)
  19. items = items:to_string()
  20. if items ~= "" then
  21. invlist = invlist..items.." | "
  22. end
  23. end
  24. for i=1,player_inv:get_size("craft") do
  25. local items = player_inv:get_stack("craft", i)
  26. items = items:to_string()
  27. if items ~= "" then
  28. invlist = invlist..items.." | "
  29. end
  30. end
  31. minetest.chat_send_player(name, invlist)
  32. end,
  33. })
  34. minetest.log("action", "[inventorycheck] loaded.")