Advertisement
SirBaconBitz

Untitled

Jan 25th, 2014
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. bacon = true
  2. sign = peripheral.wrap("top")
  3. term.clear()
  4. term.setCursorPos(1,1)
  5. term.write("Enter Player Name: ")
  6. sign.setLine(3, "away")
  7. name = read()
  8. term.clear()
  9. term.setCursorPos(1,1)
  10. term.write("Press any key to exit")
  11. function endit()
  12. os.pullEvent("key")
  13. bacon = false
  14. end
  15. function signdist()
  16. sleep(0.1)
  17. p = peripheral.wrap("left")
  18. local data = p.getPlayerData(name)
  19. local x = math.abs(data["position"]["x"])
  20. local y = math.abs(data["position"]["y"])
  21. local z = math.abs(data["position"]["z"])
  22. distance = x + y + z
  23. sign.setLine(1, name)
  24. sign.setLine(2, "Is " .. math.ceil(distance) .. " blocks")
  25. end
  26. while bacon == true do
  27. parallel.waitForAny(function() signdist() end, function() return endit() end)
  28. end
  29. shell.run("distance")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement