Advertisement
Daraketh

Password Door Lock Basic

Jul 2nd, 2013
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. local pullEvent = os.pullEvent --Makes a copy of os.pullEvent to pullEvent.
  2. os.pullEvent = os.pullEventRaw --Stops users using Ctrl+T to terminate program.
  3.  
  4. term.clear() --Clear monitor.
  5. term.setCursorPos(1,1) --Sets cursor to top left position.
  6.  
  7. local password = "The falcon doth soar high above" --This is the password.
  8. local passwordshort = "lemonparty" --I included a shorter version, too.
  9. local debugpassword = "admin mode go" --debugging mode, allows use of Ctrl+T again to terminate.
  10.  
  11. write("Enter your password: ")
  12. local input = read()  --Users input is assigned to variable input
  13.  
  14. if input == debugpassword then
  15.  
  16.     os.pullEvent = pullEvent
  17.     print("Hold Ctrl + T to break")
  18.    
  19.     sleep(5)
  20.  
  21. elseif (input == password) or (input == passwordshort) then
  22.  
  23.     print("That is correct, you have 2 seconds to get inside.")
  24.    
  25.     redstone.setOutput("left", true)
  26.     redstone.setOutput("back", true)
  27.    
  28. else
  29.  
  30.     print("Nope.avi")
  31.    
  32. end
  33.  
  34. print("Closing in...")
  35.  
  36. for i=0, 2, 1 do
  37.    
  38.     sleep(1)
  39.    
  40.     print(2-i)
  41.    
  42. end
  43.    
  44. os.shutdown()  --Shut down the computer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement