Advertisement
colhaydutu

radartest2

Sep 27th, 2023 (edited)
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. local radar = peripheral.wrap("top")
  2.  
  3. redstone.setOutput("back",true)
  4. while true do
  5.  
  6. local players = radar.getPlayers()
  7.  
  8. for i = 1, #players do
  9. local playerName = players[i]["name"]
  10. local distance = players[i]["distance"]
  11.  
  12. if (playerName == "colhaydutu" or playerName == "989598") and distance < 4 then
  13. redstone.setOutput("back", false)
  14. sleep(3)
  15. else
  16. redstone.setOutput("back", true)
  17. end
  18. end
  19.  
  20. sleep(0.1)
  21. redstone.setOutput("back", true)
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement