Nathan1852

Doorsensor

Nov 10th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. local side1 = "left" -- The side the sensor is on
  2. local side2 = "right" -- The side the door is on
  3. local time = 5 -- Time the door should be open
  4. local names = {"netchip", "bas"}
  5.  
  6. sensor = peripheral.wrap(side1)
  7.  
  8. while true do
  9. for i,v in pairs(sensor.getPlayerNames())
  10. for k,y in pairs(names) do
  11. if tostring(v) == tostring(y) then
  12. rs.setOutput(side2, true)
  13. sleep(time)
  14. rs.setOutput(side2, false)
  15. end
  16. end
  17. end
  18. sleep(0.1)
  19. end
Advertisement
Add Comment
Please, Sign In to add comment