Advertisement
colhaydutu

radartest

Sep 8th, 2023 (edited)
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. local monitor = peripheral.wrap("left")
  2. local radar = peripheral.wrap("right")
  3.  
  4. while true do
  5. local players = radar.getPlayers()
  6.  
  7. monitor.clear()
  8.  
  9. for i = 1, #players do
  10. local playerName = players[i]["name"]
  11. local distance = players[i]["distance"]
  12.  
  13. if playerName ~= "" and playerName ~= nil then
  14. monitor.setCursorPos(1, i)
  15. monitor.write("Player: " .. playerName .. " -- Distance: " .. distance)
  16. end
  17. end
  18.  
  19.  
  20. sleep(0.1)
  21. end
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement