Advertisement
Guest User

lock

a guest
May 12th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.56 KB | None | 0 0
  1. --os.pullEvent = os.pullEventRaw
  2. local monitor = peripheral.find("monitor")
  3. function lock()
  4.   if peripheral.find("monitor") then
  5.     monitor.setBackgroundColor(colors.red)
  6.     monitor.clear()
  7.     monitor.setTextScale(3)
  8.     monitor.setCursorPos(2,5)
  9.     monitor.write("Currently Locked")
  10.   end
  11.   term.clear()
  12.   term.setCursorPos(1,1)
  13.   term.setTextColor(colors.yellow)
  14.   textutils.slowPrint("MC Crafters Security System")
  15.   term.setTextColor(colors.white)
  16.   sleep(1)
  17.   textutils.slowWrite("Username: ")
  18.   user = term.setTextColor(colors.yellow)
  19.   user = read()
  20.   term.setTextColor(colors.white)
  21.   textutils.slowWrite("Password: ")
  22.   pass = term.setTextColor(colors.yellow)
  23.   pass = read("*")
  24.   if user == "Admin" and pass == "password" then
  25.     term.setCursorPos(1,4)
  26.     term.setTextColor(colors.green)
  27.     textutils.slowPrint("Valid Login Credentials, Welcome to The System.")
  28.     if peripheral.find("monitor") then
  29.        monitor.setBackgroundColor(colors.green)
  30.        monitor.clear()
  31.        monitor.setCursorPos(2,5)
  32.        monitor.write("Currently Unlocked")
  33.     end
  34.     sleep(2)
  35.     term.clear()
  36.     term.setCursorPos(1,1)
  37.     term.setTextColor(colors.yellow)
  38.     print(os.version())
  39.     term.setCursorPos(1,2)
  40.   else
  41.     term.setCursorPos(1,4)
  42.     term.setTextColor(colors.red)
  43.     textutils.slowPrint("Invalid Login Credenials, Please Don't Try Again.")
  44.     sleep(2)
  45.     lock()
  46.   end
  47. end
  48.  
  49. if not fs.exists("startup") then
  50.   local file = fs.open("startup", "w")
  51.   file.write("shell.run(\"lock\")")
  52.   file.close()
  53.   os.reboot()
  54. end
  55.  
  56. lock()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement