Plazter

Door controller

Mar 31st, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. local ID = 240
  2.  
  3. term.clear()
  4. term.setCursorPos(1,1)
  5.  
  6. rednet.open("left") -- only need to open once, not each loop
  7.  
  8. while true do
  9. local event, player = os.pullEventRaw('player') -- wait here for a player... reduces lag... using pullEventRaw means the program cannot be terminated
  10.  
  11. if player == 'Plazter' or 'AlternateLogic' then
  12. rednet.send(ID, player)
  13. print("Player: "..player.." entered!")
  14. rs.setOutput("bottom", false)
  15.  
  16. os.startTimer(2) -- the following 2 lines is a way to sleep without allowing program termination
  17. os.pullEventRaw('timer')
  18.  
  19. rs.setOutput("bottom", true)
  20. else
  21. rednet.send(ID, "Unauthorized")
  22. print(player.." tryed to enter the plazter cave!!")
  23. end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment