Advertisement
Viper741

ComputerCraft Password Door

Jul 14th, 2014
697
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. local pass = "" --Enter your pass-phrase here.
  3. local bypass = "" --Enter a pass-phrase to escape to the system here.
  4. if pass == "" or bypass == "" then
  5.     print("Please set the password and bypass phrase before running the program by editing it.")
  6.     return
  7. elseif pass == bypass then
  8.     print("Please make sure your password and bypass phrase are not the same.")
  9.     return
  10. end
  11. while true do
  12.     term.clear()
  13.     term.setCursorPos(1, 1)
  14.     write("Enter password: ")
  15.     input = read("*")
  16.     if input == pass then
  17.         term.setTextColor(colors.green)
  18.         print("Access granted.")
  19.         redstone.setOutput("left", true) --Make sure to replace "left" with the side the door is on.
  20.         pcall(sleep,3) --Set the door open time here (seconds).
  21.         redstone.setOutput("left", false)
  22.         term.setTextColor(colors.white)
  23.     elseif input == bypass then
  24.         term.setTextColor(colors.green)
  25.         print("System bypass granted.")
  26.         term.setTextColor(colors.white)
  27.         return
  28.     else
  29.         term.setTextColor(colors.red)
  30.         print("Access denied.")
  31.         term.setTextColor(colors.white)
  32.         pcall(sleep,2)
  33.     end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement