Advertisement
Guest User

lock

a guest
Oct 15th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.94 KB | None | 0 0
  1. oldPull = os.pullEvent
  2. os.pullEvent = os.pullEventRaw
  3.  
  4. local database = {
  5.   ["user1"] = "pass1",
  6.   ["user2"] = "pass2",
  7. }
  8.  
  9. while true do
  10.   term.setBackgroundColor(colors.lightGray)
  11.   term.clear()
  12.   paintutils.drawFilledBox(3,3,50,18,colors.gray)
  13.   paintutils.drawFilledBox(2,2,49,17,colors.white)
  14.   paintutils.drawLine(3,3,48,3,colors.lightGray)
  15.   paintutils.drawLine(3,5,48,5,colors.gray)
  16.   term.setCursorPos(4,7)
  17.   term.setBackgroundColor(colors.white)
  18.   term.setTextColor(colors.black)
  19.   write("Sign into your computer to access files")
  20.   term.setCursorPos(4,9)
  21.   write("and applications.")
  22.   term.setCursorPos(4,16)
  23.   term.setTextColor(colors.gray)
  24.   write("QuantumTech PCLock v1")
  25.   term.setCursorPos(4,14)
  26.   term.setTextColor(colors.black)
  27.   write("Status: ")
  28.   term.setTextColor(colors.lightGray)
  29.   write("Typing")
  30.   term.setCursorPos(4,3)
  31.   term.setBackgroundColor(colors.lightGray)
  32.   term.setTextColor(colors.gray)
  33.   local user = read()
  34.   paintutils.drawLine(3,3,48,3,colors.gray)
  35.   term.setCursorPos(4,3)
  36.   term.setTextColor(colors.black)
  37.   write(user)
  38.   paintutils.drawLine(3,5,48,5,colors.lightGray)
  39.   term.setCursorPos(4,5)
  40.   term.setTextColor(colors.gray)
  41.   local password = read("*")
  42.   paintutils.drawLine(3,5,48,5,colors.gray)
  43.   term.setCursorPos(4,5)
  44.   term.setTextColor(colors.black)
  45.   write(string.rep("*",#password))
  46.   if database[user] == password then
  47.     term.setCursorPos(4,14)
  48.     term.setBackgroundColor(colors.white)
  49.     term.setTextColor(colors.black)
  50.     write("Status: ")
  51.     term.setTextColor(colors.lime)
  52.     write("Code Accepted")
  53.     sleep(1)
  54.     os.pullEvent = oldPull
  55.     term.setBackgroundColor(colors.black)
  56.     term.clear()
  57.     term.setCursorPos(1,1)
  58.     return
  59.   else
  60.     term.setBackgroundColor(colors.white)
  61.     term.setCursorPos(4,14)
  62.     term.setTextColor(colors.black)
  63.     write("Status: ")
  64.     term.setTextColor(colors.red)
  65.     write("Code Denied")
  66.     sleep(2)
  67.   end
  68. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement