Advertisement
Guest User

sensor.lua

a guest
Apr 8th, 2020
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.38 KB | None | 0 0
  1. mon = peripheral.wrap("monitor_23")
  2.  
  3. ps = peripheral.wrap("playerSensor_1")
  4. local player = "null"
  5. local range = 1
  6.  
  7. function check()
  8. pstable = ps.getNearbyPlayers()
  9. mainps = pstable[1]
  10. player = mainps.player
  11. range = mainps.distance
  12. mon.clear()
  13. if range < 10  then
  14. mon.setCursorPos(1,1)
  15. mon.write("hello "..player)
  16.  
  17. end
  18. sleep(1)
  19. end
  20.  
  21. while true do
  22. check()
  23.  
  24. sleep(1)
  25.  
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement