Advertisement
trolman5678

admin door

Sep 28th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local hello = "" --Put Password In Here
  2. local opentime = 3  --Put How long you want the door open Here
  3. local hi = "" --Put Admin Password In Here (Cannot be same as main)
  4. local left = "" --Put the Side where you door or redstone is
  5.  
  6. --os.pullEvent = os.pullEventRaw
  7. --Remove the '--' at the beginning of the previous
  8. --line to prevent people from terminating your
  9. --lock. Then add "shell.run("[name of this program here]")
  10. --to auto start this program.
  11. --THIS WILL PREVENT YOU FROM EDITING THE PROGRAM
  12. --ANY FURTHER. DO NOT DO THIS WITHOUT ENSURING
  13. --THE PROGRAM WORKS.
  14.  
  15.  
  16. --DO NOT EDIT BELOW THIS LINE--
  17.  
  18. doorlock = false
  19.  
  20. function mainP()
  21.    term.clear()
  22.    term.setCursorPos(1,1)
  23.    print("Enter Password: ")
  24.    input = read("*")
  25.    if input == password then
  26.       if doorlock == false then
  27.          print("Door Opened")
  28.          rs.setOutput(rside, true)
  29.          sleep(opentime)
  30.          print("Door Closed")
  31.          rs.setOutput(rside, false)
  32.          sleep(1)
  33.       else
  34.          print("Door Lock Enabled. Cannot Open Door")
  35.          sleep(1)
  36.          mainP()
  37.       end
  38.    elseif input == apasswrd then
  39.       admin()
  40.    else
  41.       print("Incorrect Password. Please Try Again")
  42.       sleep(2)
  43.    end
  44. end
  45.  
  46. function admin()
  47.    term.clear()
  48.    term.setCursorPos(1,1)
  49.    print("Enter Command: ")
  50.    local input = read()
  51.    if input == "Help" then
  52.       term.clear()
  53.       term.setCursorPos(1,1)
  54.       print("Commands: ")
  55.       term.setCursorPos(1,2)
  56.       print("Help - Displays this dialog")
  57.       term.setCursorPos(1,3)
  58.       print("Open - Opens the door (Bypasses lock)")
  59.       term.setCursorPos(1,4)
  60.       print("Close - Closes the door")
  61.       term.setCursorPos(1,5)
  62.       print("Lock - Locks the door")
  63.       term.setCursorPos(1,6)
  64.       print("Unlock - Unlocks the door")
  65.       term.setCursorPos(1,7)
  66.       print("Show Password - Shows the password to open the door")
  67.       term.setCursorPos(1,8)
  68.       print("Home - Returns to the main password screen")
  69.       sleep(10)
  70.       admin()
  71.    elseif input == "Open" then
  72.       rs.setOutput(rside, true)
  73.       sleep(1)
  74.       admin()
  75.    elseif input == "Close" then
  76.       rs.setOutput(rside, false)
  77.       sleep(1)
  78.       admin()
  79.    elseif input == "Lock" then
  80.       doorlock = true
  81.       sleep(1)
  82.       admin()
  83.    elseif input == "Unlock" then
  84.       doorlock = false
  85.       sleep(1)
  86.       admin()
  87.    elseif input == "Show Password" then
  88.       print(password)
  89.       sleep(3)
  90.       admin()
  91.    elseif input == "Home" then
  92.       mainP()
  93.    end
  94. end
  95.  
  96. while true do
  97.    mainP()
  98. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement