Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw -- Cancelles CTRL T
- -- Variables
- username = "finnanut"
- sudoUser = "toor"
- password = "inmybutt"
- attemptsMade = 0
- doorSide = "bottom"
- os.loadAPI("CenterText")
- function checkAttempts()
- if attemptsMade > 3 then
- term.clear()
- term.setCursorPos(1, 1)
- CenterText.center("Too many attempts have been made, Please try again in 2 minutes.")
- sleep(120)
- os.reboot()
- end
- end
- function doLogin()
- checkAttempts()
- term.clear()
- if attemptsMade > 0 then
- CenterText.center("Attempts made: " .. attemptsMade)
- end
- CenterText.center("Username: ")
- userInput = read()
- if userInput == sudoUser then
- term.clear()
- term.setCursorPos(1, 1)
- CenterText.center("Welcome into the computer.")
- elseif userInput == username then
- CenterText.center("Password: ")
- passwordInput = read("*")
- if passwordInput == password then
- term.clear()
- term.setCursorPos(1, 1)
- CenterText.center("Welcome back.")
- sleep(1)
- rs.setOutput(side, true)
- sleep(2)
- rs.setOutput(side, false)
- term.setCursorPos(1, 1)
- os.reboot()
- else
- term.clear()
- CenterText.center("Incorrect password.")
- attemptsMade = attemptsMade + 1
- sleep(1)
- term.clear()
- term.setCursorPos(1, 1)
- doLogin()
- end
- term.clear()
- term.setCursorPos(1, 1)
- CenterText.center("Incorrect username.")
- attemptsMade = attemptsMade + 1
- sleep(1)
- term.clear()
- term.setCursorPos(1, 1)
- doLogin()
- end
- end
- doLogin()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement