IronClaymore

CC basic password door

Nov 29th, 2013
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | None | 0 0
  1. local pullEvent = os.pullEvent
  2. os.pullEvent = os.pullEventRaw
  3. while true do
  4.     term.clear()
  5.     term.setCursorPos(1, 1)
  6.     term.setTextColor(colors.orange)
  7.     print("WARNING! Sludge containment breach detected!")
  8.     term.setCursorPos(1, 2)
  9.     term.setTextColor(colors.red)
  10.     print("DANGER! Toxic gasses detected in facility interior!")
  11.     term.setCursorPos(1, 3)
  12.     print("Please contact an administrator.")
  13.     term.setCursorPos(1, 4)
  14.     term.setTextColor(colors.white)
  15.     print("Enter password to open laser door: ")
  16.     input = read()
  17.     if input == "password" or input == "guest" then
  18.         term.clear()
  19.         term.setCursorPos(1, 1)
  20.         term.setTextColor(colors.green)
  21.         print("Thank you. Door will remain open for 10 seconds")
  22.         redstone.setOutput("right",true)
  23.         sleep(10)
  24.         redstone.setOutput("right",false)
  25.     elseif input == "debug" then
  26.         term.clear()
  27.         term.setCursorPos(1, 1)
  28.         term.setTextColor(colors.lightBlue)
  29.         print("Debug mode activated, hold CTRL + T to exit door program")
  30.         os.pullEvent = pullEvent
  31.         sleep(10)
  32.     elseif input ~= "password" and input ~= "debug" and input ~= "guest" then
  33.         term.clear()
  34.         term.setCursorPos(1, 1)
  35.         term.setTextColor(colors.red)
  36.         print("Incorrect password. Please try again after 10 seconds.")
  37.         sleep(10)
  38.     end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment