Advertisement
Guest User

Detect

a guest
Feb 27th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. local mon = peripheral.find("monitor")
  2. local x,y = mon.getSize()
  3. mon.setBackgroundColor(colors.blue)
  4. mon.clear()
  5. local xC,yC = math.floor((x+1)/2),math.floor((y+1)/2)
  6. term.clear()
  7. paintutils.drawLine(5,3,26,3,colors.gray)
  8. term.setTextColor(colors.white)
  9. term.setCursorPos(5,3)
  10. term.write("Quel joueur détecter ?")
  11. paintutils.drawLine(5,5,14,5,colors.lightGray)
  12. term.setTextColor(colors.lightBlue)
  13. term.setCursorPos(5,5)
  14. local name = read()
  15. mon.setCursorPos(xC-14,yC-2)
  16. mon.setTextColor(colors.yellow)
  17. mon.write(name.." se trouve à      blocs")
  18. while true do
  19. local i = 1
  20. while not commands.exec("/testfor @a[name="..name..",r="..i.."]") do
  21.   i = i + 1
  22. end
  23. term.setCursorPos(5,7)
  24. term.setBackgroundColor(colors.black)
  25. print("                                             ")
  26. term.setCursorPos(5,7)
  27. term.setBackgroundColor(colors.gray)
  28. term.setTextColor(colors.lime)
  29. print(name.." est à "..tostring(i).." blocs.")
  30. mon.setCursorPos((xC-14)+string.len(name)+14,yC-2)
  31. mon.write("    ")
  32. mon.setCursorPos((xC-14)+string.len(name)+14,yC-2)
  33. mon.setTextColor(colors.orange)
  34. mon.write(tostring(i))
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement