viggo99

Password Computer(Craft)

Apr 1st, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.85 KB | None | 0 0
  1. -- feel free to edit anything red between the
  2. -- two green lines
  3. --------------------------------------------------
  4.  
  5. -- first user login info
  6. un1 = "admin" -- change the word admin to what you
  7. -- want the username to be
  8.  
  9. cPass1 = "admin" -- change the word admin to what
  10. -- you want the password to be
  11.  
  12. -- start and welcome messages
  13. startMsg = "Welcome, please enter your username and password."
  14. welcomeMsg = ("Correct! Welcome "..un1)
  15. -- put "--" infront of
  16. -- "os.pullEvent = os.pullEventRaw" to enable
  17. -- using (CTRL + T) to terminate the password lock
  18.  
  19.  os.pullEvent = os.pullEventRaw
  20.  
  21. --------------------------------------------------
  22.  
  23. function start()
  24. term.clear()
  25. term.setCursorPos(1, 1)
  26. print(startMsg)
  27. sleep(1)
  28. print()
  29. print()
  30. print("Username:")
  31. print("Password:")
  32. sleep(0.5)
  33. term.setCursorPos(10, 4)
  34. sleep(0.3)
  35. --username code below
  36.  
  37.    ui = read()
  38.      if ui == un1 then
  39.        term.setCursorPos(10, 5)
  40.      else
  41.        term.setCursorPos(1, 7)
  42.        print("That user does not exist!")
  43.        sleep(2)
  44.        start()
  45.      end
  46.  
  47. --password code below
  48.  
  49.    passi = read("*")
  50.      if passi == cPass1 then
  51.        term.setCursorPos(1, 7)
  52.        print(welcomeMsg)
  53.        sleep(1)
  54.        if cPass1 == "admin" then
  55.          print()
  56.          print()
  57.          print("I see you have not changed password.")
  58.          print("Did you know that you can type")
  59.          print("'edit disk/startup' and change the username")
  60.          print("and password?")
  61.          print("you should try it to make your computer")
  62.          print("even more secure.")
  63.          sleep(6)
  64.        end
  65.        term.clear()
  66.        
  67.      else
  68.        term.setCursorPos(1, 7)
  69.        print("Incorrect Password! Please try again!")
  70.        sleep(2)
  71.        start()
  72.      end
  73.      
  74. end
  75. -- end of start function!
  76. start()
  77. sleep(1)
  78. term.setCursorPos(1, 1)
Add Comment
Please, Sign In to add comment