Advertisement
Guest User

lock

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