mrWhiskasss

Радар на 7 блок. радиус [OpenComputers]

Sep 30th, 2022 (edited)
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. --белый список
  2.  
  3. local white = {
  4. "DevilPuppy",
  5. "4epB9Ik",
  6. }
  7.  
  8. local com = require('component')
  9. local event = require("event")
  10. local term = require('term')
  11. local radar = com.isAvailable("radar") and com.radar or error("нет радара")
  12. local gpu = com.gpu
  13. local w,h = gpu.getViewport()
  14.  
  15. gpu.setResolution(35,15)
  16.  
  17. function checkAdmin(text)
  18. for i = 1, 5 do
  19. if white[i] == text then
  20. return false
  21. end
  22. end
  23. return true
  24. end
  25.  
  26. while true do
  27. local pl = radar.getPlayers()
  28. term.clear()
  29. gpu.setForeground(0xffb600)
  30. gpu.set(2,1, 'Игроков в кабинке:')
  31. for i = 1, #pl do
  32. gpu.setForeground(0xff0000)
  33.  
  34. if checkAdmin(pl[i].name) then
  35.  
  36.  
  37. if math.floor(pl[i].distance)<256 then
  38. gpu.set(2, i+1, ' '..pl[i].name)
  39. gpu.set(20, i+1, ' - '..math.floor(pl[i].distance)..'м.')
  40. end
  41. end
  42. end
  43. local e = ({event.pull(5,"key_down")})[4]
  44. if e == 29 or e == 157 then -- Ctrl Выход
  45. gpu.setResolution(w,h)
  46. gpu.setBackground(0x000000)
  47. gpu.setForeground(0xFFFFFF)
  48. os.execute("cls")
  49. os.exit()
  50. end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment