Advertisement
4epB9Ik

Radar.lua

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