Advertisement
Guest User

Untitled

a guest
Nov 4th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw -- Cancelles CTRL T
  2.  
  3. -- Variables
  4. username = "finnanut"
  5. sudoUser = "toor"
  6. password = "inmybutt"
  7. attemptsMade = 0
  8.  
  9. doorSide = "bottom"
  10.  
  11. os.loadAPI("CenterText")
  12.  
  13. function checkAttempts()
  14. if attemptsMade > 3 then
  15. term.clear()
  16. term.setCursorPos(1, 1)
  17. CenterText.center("Too many attempts have been made, Please try again in 2 minutes.")
  18. sleep(120)
  19. os.reboot()
  20. end
  21. end
  22.  
  23. function doLogin()
  24. checkAttempts()
  25.  
  26. term.clear()
  27.  
  28. if attemptsMade > 0 then
  29. CenterText.center("Attempts made: " .. attemptsMade)
  30. end
  31.  
  32. CenterText.center("Username: ")
  33. userInput = read()
  34.  
  35. if userInput == sudoUser then
  36. term.clear()
  37. term.setCursorPos(1, 1)
  38. CenterText.center("Welcome into the computer.")
  39.  
  40. elseif userInput == username then
  41. CenterText.center("Password: ")
  42. passwordInput = read("*")
  43.  
  44. if passwordInput == password then
  45. term.clear()
  46. term.setCursorPos(1, 1)
  47. CenterText.center("Welcome back.")
  48.  
  49. sleep(1)
  50. rs.setOutput(side, true)
  51. sleep(2)
  52. rs.setOutput(side, false)
  53.  
  54. term.setCursorPos(1, 1)
  55. os.reboot()
  56.  
  57. else
  58. term.clear()
  59. CenterText.center("Incorrect password.")
  60. attemptsMade = attemptsMade + 1
  61. sleep(1)
  62. term.clear()
  63. term.setCursorPos(1, 1)
  64. doLogin()
  65. end
  66. term.clear()
  67. term.setCursorPos(1, 1)
  68. CenterText.center("Incorrect username.")
  69. attemptsMade = attemptsMade + 1
  70. sleep(1)
  71. term.clear()
  72. term.setCursorPos(1, 1)
  73. doLogin()
  74. end
  75. end
  76.  
  77. doLogin()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement