Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function install()
- local login = fs.exists("/os/usr/login")
- local motd = fs.exists("/os/usr/motd")
- local version = fs.exists("/os/usr/version")
- local path = fs.exists("/os/usr")
- if path == true then
- if motd == true then
- if version == true then
- if login == true then
- return
- elseif login == false then
- local login = fs.open("/os/usr/login", "w")
- print("test")
- end
- elseif version == false then
- local version = fs.open("/os/usr/version", "w")
- version.write("V.1.0")
- print("version creer")
- end
- elseif motd == false then
- local motd = fs.open("/os/usr/motd", "w")
- motd.write("Windob OS")
- print("motd creer")
- end
- elseif path == false then
- fs.makeDir("/os/usr")
- print("dossier creer")
- end
- end
- function hud()
- local motd = fs.open("/os/usr/motd", fs.exists("/os/usr/motd") and "r")
- local version = fs.open("/os/usr/version", fs.exists("/os/usr/version") and "r")
- local x, y = term.getSize()
- x = 1
- while x < 52 do
- term.setCursorPos(x, 1)
- term.write("-")
- x = x+1
- end
- x = 1
- while x < 52 do
- term.setCursorPos(x, 3)
- term.write("-")
- x = x+1
- end
- y = 2
- x = 46
- term.setCursorPos(x, y)
- term.write("|")
- term.setCursorPos(1, 2)
- term.write(motd.readAll())
- term.setCursorPos(47, 2)
- term.write(version.readAll())
- end
- function drawLogin()
- local username = "Username :"
- local password = "Password :"
- local x, y = term.getSize()
- x = 19
- while x < 33 do
- term.setCursorPos(x, y/2.5)
- term.write("-")
- x = x+1
- end
- x = 19
- while x < 33 do
- term.setCursorPos(x, y/2)
- term.write("-")
- x = x+1
- end
- x = 19
- while x < 33 do
- term.setCursorPos(x, y/1.6)
- term.write("-")
- x = x+1
- end
- x = 19
- while x < 33 do
- term.setCursorPos(x, y/1.45)
- term.write("-")
- x = x+1
- end
- x = 19
- while x < 33 do
- term.setCursorPos(x, y/1.2)
- term.write("-")
- x = x+1
- end
- y = 7
- x = 18
- while y < 16 do
- term.setCursorPos(x, y)
- term.write("|")
- y = y+1
- end
- y = 7
- x = 33
- while y < 16 do
- term.setCursorPos(x, y)
- term.write("|")
- y = y+1
- end
- term.setCursorPos(21, 8)
- print(username)
- term.setCursorPos(21, 12)
- print(password)
- end
- function login()
- local login = fs.open("/os/usr/login", fs.exists("/os/usr/login") and "r")
- term.setCursorPos(19, 10)
- local username = read()
- term.setCursorPos(19, 14)
- local password = read("*")
- if username == login.readLine(1, 1) then
- if password == login.readLine(1, 2) then
- term.clear()
- hud()
- term.setCursorPos(1, 5)
- return
- elseif password then
- term.setCursorPos(17, 17)
- term.write("Something's wrong !")
- os.sleep(2)
- os.reboot()
- end
- elseif username then
- term.setCursorPos(17, 17)
- term.write("Something's wrong !")
- os.sleep(2)
- os.reboot()
- end
- end
- term.clear()
- install()
- --parallel.waitForAll(hud, drawLogin, login)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement