Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function center()
- term.setCursorPos(26,10)
- end
- os.pullEvent = os.pullEventRaw
- term.clear()
- term.setCursorPos(1,1)
- local tries = 3
- local correct = 0
- while tries > 0 and correct == 0 do
- term.clear()
- term.setCursorPos(1, 1)
- print('You have '..tries..' tries to login!')
- print('Username: ')
- term.setCursorPos(11, 2)
- local Username = read()
- print('Password: ')
- term.setCursorPos(11, 3)
- local password = read('*')
- local doesExist = 0
- if fs.exists('/.Users/.'..Username) == true then
- local userFile = fs.open('/.Users/.'..Username, 'r')
- local correctPass = userFile.readAll()
- doesExist = 1
- else
- doesExist = 0
- end
- if password == correctPass and doesExist == 1 then
- shell.run('/.aOS/Menu')
- correct = 1
- else
- tries = tries - 1
- if doesExist == 1 then
- userFile.close()
- end
- end
- end
- if tries == 0 then
- term.clear()
- term.setCursorPos(1, 1)
- print('You ran out of tries to login!')
- sleep(2)
- os.reboot()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement