Advertisement
Guest User

startup

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