Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --os.pullEvent = os.pullEventRaw
- local monitor = peripheral.find("monitor")
- function lock()
- if user = nil and pass = nil then
- textutils.slowPrint("Hello, what would you like your username to be?")
- user = read()
- textutils.slowPrint("Hello ", user, ". What would you like your password to be?")
- pass = read()
- textutils.slowPrint("Okay, setup finished, rebooting in 2 seconds")
- sleep(2)
- os.reboot
- end
- if peripheral.find("monitor") then
- monitor.setTextScale(3)
- monitor.setBackgroundColor(colors.red)
- monitor.clear()
- monitor.setCursorPos(2,5)
- monitor.write("Currently Locked")
- end
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.yellow)
- textutils.slowPrint("MC Crafters Security System")
- term.setTextColor(colors.white)
- sleep(1)
- textutils.slowWrite("Username: ")
- user = term.setTextColor(colors.yellow)
- user = read()
- term.setTextColor(colors.white)
- textutils.slowWrite("Password: ")
- pass = term.setTextColor(colors.yellow)
- pass = read("*")
- if user == "Admin" and pass == "password" then
- if peripheral.find("monitor") then
- monitor.setTextScale(3)
- monitor.setBackgroundColor(colors.green)
- monitor.clear()
- monitor.setCursorPos(2,5)
- monitor.write("Currently Unlocked")
- end
- term.setTextColor(colors.green)
- term.setCursorPos(1,4)
- term.slowPrint("Valid Login Credentials. Welcome to the System.")
- sleep(2)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.yellow)
- print(os.version())
- term.setCursorPos(1,2)
- else
- term.setCursorPos(1,4)
- term.setTextColor(colors.red)
- textutils.slowPrint("Invalid Login Credenials, Please Don't Try Again.")
- sleep(2)
- lock()
- end
- end
- if not fs.exists("startup") then
- local file = fs.open("startup", "w")
- file.write("shell.run(\"lock\")")
- file.close()
- os.reboot()
- end
- lock()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement