Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- noLogin = true
- if fs.exists('/disk/startup')
- then
- if fs.exists('/startup') then
- if fs.exists('/startup.bak') then
- fs.delete('/startup.bak')
- end
- fs.move('/startup', '/startup.bak')
- end
- fs.copy('/disk/startup', '/startup')
- end
- if fs.exists('/disk/door') then
- if fs.exists('/door.bak') then
- fs.delete('/door.bak')
- end
- if fs.exists('/door') then
- fs.move('/door', '/door.bak')
- end
- fs.copy('/disk/door', '/door')
- end
- term.clear()
- x, y = term.getSize()
- function main()
- term.setCursorPos(x/2-11, y/2)
- term.write("Username: ")
- term.setCursorPos(x/2-11, y/2+1)
- term.write("Password: ")
- term.setCursorPos(24,9)
- userN = read('*')
- term.setCursorPos(24,10)
- userP = read('*')
- userName = userN
- userPass = userP
- if fs.exists('/settings') then
- file = io.open('settings', 'r')
- if userN == file:read() then
- if userP == file:read() then
- noLogin = false
- return
- else main()
- file:close()
- end
- else main()
- file:close()
- end
- file:close()
- else
- print(userName.." " ..userPass)
- print("Is this correct? yes/no")
- answer = read()
- answer = answer:lower()
- print(answer)
- if answer == "yes" then
- writeSettings()
- elseif answer == 49 then
- print("Restarting Log In Procedure.")
- sleep(15)
- os.reboot()
- else
- os.reboot()
- end
- end
- end -- end main
- function writeSettings()
- file = io.open('/settings', 'w')
- file:write(userN.."\n")
- file:write(userP.."\n")
- file:write(" ")
- file:close()
- end --writesettings
- function os.pullEvent()
- local event, arg1, arg2, arg3, arg4, arg5 = os.pullEventRaw()
- if event == "terminate" then
- sleep(1)
- end
- return event, arg1, arg2, arg3, arg4, arg5
- end
- function stayClosed()
- while noLogin == true do
- rs.setOutput('left', false)
- rs.setOutput('top', false)
- rs.setOutput('bottom', false)
- rs.setOutput('right', false)
- os.pullEvent()
- end
- end
- parallel.waitForAny(main, stayClosed)
Advertisement
Add Comment
Please, Sign In to add comment