Nikitaaa228

Untitled

Nov 5th, 2020
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. local term = require('term')
  2. local computer = require("computer")
  3. local com = require('component')
  4. local sensor = com.os_entdetector
  5. local gpu = com.gpu
  6. local floor = math.floor
  7.  
  8.  
  9. color = {
  10. green = 0x00ff00,
  11. yellow = 0xffb600,
  12. red = 0xff0000
  13. }
  14.  
  15. -- Белый список ---
  16. white = {
  17. none = false
  18. }
  19.  
  20.  
  21. gpu.setResolution(35,15)
  22.  
  23. while true do
  24. pl = sensor.scanPlayers(64)
  25. term.clear()
  26. gpu.setForeground(color.yellow)
  27. gpu.set(2,1, 'В зоне обнаружения радара: '..#pl..' чел.')
  28. for i = 1, #pl do
  29. if white[pl[i].name] then gpu.setForeground(color.green)
  30. else gpu.setForeground(color.red)
  31. computer.beep(440, 1) end
  32. gpu.set(2, i+1, i..'. '..pl[i].name)
  33. gpu.set(25, i+1, ' - '..floor(pl[i].distance)..' м')
  34. end
  35. os.sleep(1)
  36. end
Advertisement
Add Comment
Please, Sign In to add comment