Advertisement
jille_Jr

CC: xxangel17xx's Multi-door lock

Nov 1st, 2012
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.96 KB | None | 0 0
  1. oldPull = os.pullEvent
  2. os.pullEvent = os.pullEventRaw
  3.  
  4. local input = ""
  5. local side = "bottom"
  6. local pass = {
  7.   pass1 = "opendoor1", pass1color = colors.red,
  8.   pass2 = "opendoor2", pass2color = colors.green,
  9.   pass3 = "opendoor3", pass3color = colors.blue,
  10.   pass4 = "opendoor4", pass4color = colors.yellow,
  11.   pass5 = "opendoor5", pass5color = colors.lime,
  12.   pass6 = "opendoor6", pass6color = colors.white,
  13.   pass7 = "opendoor7", pass7color = colors.pink,
  14.   pass8 = "opendoor8", pass8color = colors.black,
  15.   pass9 = "opendoor9", pass9color = colors.brown,
  16.   admin = "passadmin"
  17. }
  18.  
  19. function checkPass(password)
  20.   for id,value in pairs(pass) do
  21.     if password == value then
  22.       if id ~= "admin" then
  23.         return true, id
  24.       else
  25.         return "admin"
  26.       end
  27.     end
  28.   end
  29.   return false
  30. end
  31.  
  32. while true do
  33.   term.clear()
  34.   term.setCursorPos(1,1)
  35.  
  36.   print("Welcome to Evolution-Lock v.1.0")
  37.   print("Please Enter a Door password")
  38.   print("=[roomname]=[roomname]=[roomname]=")--Change [roomname] to the name of your room's
  39.   print("=[roomname]=[roomname]=[roomname]=")--Change [roomname] to the name of your room's
  40.   print("=[roomname]=[roomname]=[roomname]=")--Change [roomname] to the name of your room's
  41.   write("Password: ")
  42.  
  43.   input, passID = checkPass(read("*"))
  44.  
  45.   if input == true then
  46.     rs.setBundledOutput(side, pass[passID.."color"])
  47.     print()
  48.     local x,y = term.getCursorPos()
  49.     for time = 7, 1, -1 do
  50.       term.setCursorPos(x,y)
  51.       term.clearLine()
  52.       write("Closing door in "..time.." seconds!")
  53.       sleep(1)
  54.     end
  55.     rs.setBundledOutput(side, 0)
  56.   elseif input == "admin" then
  57.     term.clear()
  58.     term.setCursorPos(1,1)
  59.     print("Password correct!")
  60.     print("Computer unlocking...")
  61.     print("Please type 'reboot' or 'shutdown' before leaving")
  62.     break
  63.   else
  64.     term.clear()
  65.     term.setCursorPos(1,1)
  66.     print("Incorrect password!")
  67.     sleep(2)
  68.   end
  69. end
  70.  
  71. os.pullEvent = oldPull
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement