Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Version = "1.0.0"
- local ComputerVersion = "1.0.0"
- local System = os -- Used for System things like os.time() to System.time()
- local Screen = term -- Used for Screen thing on the turtle or computer like term.clear() to Screen.clear()
- local Per = peripheral -- Used shortcut for peripheral
- local Text = textutils -- Used shortcut for textilils
- local Pack = Text.serialize -- Makes a new command for packing ( shortcut used from local Text)
- local UnPack = Text.unserialize -- Makes a new command for unpacking ( shortcut used from local Text)
- local OldpullEvent = System.pullEvent
- System.pullEvent = System.pullEventRaw
- local Computer = { ComputerName = "Computer",
- Status = true,
- LogOn = false
- }
- local User = { }
- local Temp = { }
- function SaveTemp()
- Computer.UserName = User.UserName
- local Data = Pack(Computer)
- File = fs.open("OS/Temp/Temp.Tem", "w")
- File.write(Data)
- File.close()
- end
- local False = 0
- function Loading()
- local File = fs.exists("OS/Users/."..User.UserName..".Acc")
- if not(File) then
- Screen.clear()
- local X, Y = Screen.getSize()
- local Y2 = Y / 2
- Screen.setCursorPos(1, Y2)
- print(User.UserName.." dont exists!!!")
- sleep(3)
- return false
- else
- File = fs.open("OS/Users/."..User.UserName..".Acc", "r")
- Data = UnPack(File.readAll())
- File.close()
- Temp.UserName = Data.UserName
- Temp.Pass = Data.Pass
- if User.Pass == Temp.Pass then
- Screen.clear()
- local X, Y = Screen.getSize()
- local Y2 = Y / 2
- Screen.setCursorPos(1, Y2)
- print("Password Accepted!!!")
- sleep(3)
- return true
- else
- Screen.clear()
- local X, Y = Screen.getSize()
- local Y2 = Y / 2
- Screen.setCursorPos(1, Y2)
- print("Wrong Password!!!")
- False = False + 1
- sleep(3)
- if False == 3 then
- os.reboot()
- end
- return false
- end
- Screen.clear()
- local X, Y = Screen.getSize()
- local Y2 = Y / 2
- Screen.setCursorPos(1, Y2)
- print(User.UserName.." already exists!!!")
- sleep(3)
- return false
- end
- end
- while not(Computer.LogOn) do
- Screen.clear()
- local X, Y = Screen.getSize()
- local Temp = X / 2
- local X2 = Temp - 2
- Screen.setCursorPos(X2, 1)
- print("Login :")
- Temp = Y / 2
- local Y2 = Temp - 1
- Screen.setCursorPos(1, Y2)
- write("UserName: ")
- User.UserName = io.read()
- Screen.setCursorPos(1, Y2+1)
- write("Password: ")
- User.Pass = read("*")
- Computer.LogOn = Loading()
- if Computer.LogOn then
- SaveTemp()
- end
- end
Add Comment
Please, Sign In to add comment