Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local term = require('term')
- local com = require('component')
- local gpu = com.gpu
- local GUI = require("GUI")
- floor = math.floor
- gpu.setBackground(0x000000)
- gpu.setForeground(0xffffff)
- local w, h = gpu.getResolution()
- gpu.fill(1, 1, w, h, " ") -- очищаем экран
- if com.isAvailable("radar") then
- sensor = com.radar
- elseif com.isAvailable("openperipheral_sensor") then
- sensor = com.openperipheral_sensor
- else GUI.alert("Для работы программы нужен радар из мода Computronics или Sensor из аддона OpenPeripheral")
- return
- end
- while true do
- gpu.setResolution(35,15)
- pl = sensor.getPlayers()
- term.clear()
- gpu.setForeground(0xffb600)
- gpu.set(2,1, 'В зоне обнаружения радара: '..#pl..' чел.')
- for i = 1, #pl do
- gpu.setForeground(0xffffff)
- gpu.set(2, i+1, i..'. '..pl[i].name)
- if com.isAvailable("radar") then
- gpu.set(25, i+1, ' - '..floor(pl[i].distance)..' м')
- end
- end
- os.sleep(3)
- end
Advertisement
Add Comment
Please, Sign In to add comment