stoneharry

Untitled

Feb 19th, 2012
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. local password = "bose"
  2.  
  3. print("----------------------------")
  4. print("| Spenton Mining Facility  |")
  5. print("----------------------------")
  6. print(" ")
  7. print("Welcome! Please enter in the password.")
  8.  
  9. write("Password: ")
  10.  
  11. local input = read()
  12.  
  13. if (input == password) then
  14.     print " "
  15.     print "Thank you for logging in!"
  16.    
  17.     sleep (2) -- sleeping a Lua thread? Surprised it works
  18.    
  19.     print " "
  20.     print "Please enter in a numerical choice."
  21.     print "[1]: Open Door"
  22.     print "[2]: Close Door"
  23.     print "[3]: Log off"
  24.     print " "
  25.    
  26.     write "(1/2/3): "
  27.    
  28.     local choice = read()
  29.     if choice == "1" then
  30.         print "Unlocking door, please wait..."
  31.         sleep (2)
  32.         redstone.setOutput("back", true)
  33.         print "Door unlocked!"
  34.         sleep (5)
  35.         -- system.os.reboot() would reboot the computer if Lua is unprotected
  36.         os.reboot()
  37.  
  38.     elseif choice == "2" then
  39.  
  40.         print "Locking door, please wait..."
  41.         sleep (2)
  42.         redstone.setOutput("back", false)
  43.         print "Door locked!"
  44.         sleep (5)
  45.         os.reboot()
  46.  
  47.     elseif choice == "3" then
  48.  
  49.         print "Ending session, please wait..."
  50.         sleep (2)
  51.         os.reboot()
  52.  
  53.     else
  54.  
  55.         print "Invalid choice, ending session..."
  56.         sleep (2)
  57.         os.reboot()
  58.        
  59.     end
  60. else
  61.     print "Incorrect Password!"
  62.     sleep (2)
  63.     print "Ending session..."
  64.     sleep (2)
  65.     os.reboot()
  66. end
Advertisement
Add Comment
Please, Sign In to add comment