Guest User

Untitled

a guest
Aug 10th, 2017
75
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. minetest.register_on_player_receive_fields(function(player,formname,fields)
  2. local name = player:get_player_name()
  3. if fields.saw then
  4. local creative = minetest.setting_getbool("creative_mode") or minetest.check_player_privs(name,{creative=true})
  5. local havesaw = player:get_inventory():contains_item("main","moreblocks:circular_saw")
  6. if havesaw or creative then
  7. minetest.show_formspec(name,"invsaw:saw",string.format(invsaw.formspec,name,name,name,invsaw.users[name].max_offered,name))
  8. else
  9. minetest.show_formspec(name,"invsaw:nosaw",invsaw.nosawformspec)
  10. end
  11. return true
  12. elseif formname == "invsaw:saw" and fields.Set then
  13. invsaw.users[name].max_offered = tonumber(fields.max_offered) or 99
  14. invsaw.update_inventory(invsaw.users[name].inv,name,0)
  15. minetest.show_formspec(name,"invsaw:saw",string.format(invsaw.formspec,name,name,name,invsaw.users[name].max_offered,name))
  16. return true
  17. elseif fields.Back then
  18. local player_name = player:get_player_name()
  19. local waypoints = "waypoints"
  20. --unified_inventory.set_inventory_formspec(player_name, waypoints)
  21. minetest.chat_send_player(name,"No waypoint") --THIS LINE PRINTS
  22. minetest.chat_send_player(player,"No waypoint 2") --THIS LINE CRASHES IT
  23. minetest.chat_send_player(player_name,"No waypoint 3") --THINS LINE PRINTS
  24. else
  25. return false
  26. end
  27. end)
RAW Paste Data