Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function cleer()
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- end
- if fs.exists("saves") then
- print("yes")
- sleep(1)
- else
- fs.makeDir("saves")
- fs.makeDir("saves/OS")
- fs.open("saves/OS/accounts","w")
- print("no but i made one")
- sleep(1)
- end
- function login(User)
- cleer()
- write("Password: ")
- local Pass = read("*")
- local file = fs.open("saves/"..User.."/info","r")
- inputPass = file.readLine()
- file.close()
- cleer()
- if inputPass == Pass then
- write("correct")
- sleep(2)
- else
- write("incorrect")
- sleep(2)
- end
- end
- function makeAcc()
- cleer()
- write("Username: ")
- local Username = read()
- term.setCursorPos(1,2)
- write("Password: ")
- local Pass = read("*")
- fs.makeDir("saves/"..Username)
- fs.makeDir("saves/"..Username.."/desktop")
- local file = fs.open("saves/"..Username.."/info","w")
- file.writeLine(Pass)
- file.close()
- cleer()
- write("Rebooting")
- sleep(1)
- end
- cleer()
- local width, height = term.getSize()
- term.setCursorPos(math.floor(width-string.len("Welcome"))/2,1)
- print("Welcome")
- term.setCursorPos(1,2)
- local FileList = fs.list("saves")
- local menuContents = {}
- local internalNum = 1
- for _,file in ipairs(FileList) do
- print(file)
- table.insert(menuContents, internalNum, file)
- internalNum = internalNum + 1
- end
- term.setCursorPos(1,19)
- write("Create Account")
- local event,button,x,y = os.pullEvent("mouse_click")
- if x >= 1 and x <= string.len("Create Account") and y == 19 then
- cleer()
- makeAcc()
- elseif x >1 and x <= string.len(menuContents[y-1]) and y == 3 then
- local User = tostring(menuContents[y-1])
- login(User)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement