Advertisement
kremnev8

Door lock

Feb 5th, 2015
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---------------- Config -----------------------------------------------------
  2. RS_SIDE = "right" -- redstone side to open
  3. RS_DELAY = 3 -- delay for redstone signal
  4. PASSWORD = "exit()" -- password to terminate
  5. -----------------------------------------------------------------------------
  6.  
  7. local function pulse(side)
  8. rs.setOutput(side, true)
  9. sleep(RS_DELAY)
  10. rs.setOutput(side,false)
  11. end
  12. Tr = true
  13. function os.pullEvent()
  14. local event, p1,p2,p3,p4,p5 = os.pullEventRaw()
  15. if event == "terminate" then
  16. write("For terminate need password:")
  17. p = read("*")
  18. if p == PASSWORD then Tr = false end
  19. end
  20. return event,p1,p2,p3,p4,p5
  21. end
  22.  
  23. while Tr do
  24. Recive = {"","",""}
  25. Recive[1],Recive[2],Recive[3] = os.pullEvent()
  26. pL = fs.list("Assets")
  27. if Recive[1] == "player" then
  28. for i =1 , 10 ,1 do
  29. if Recive[3] == pL[i] then
  30. pulse(RS_SIDE)
  31. break
  32. end
  33. end
  34. end
  35.  
  36.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement