SHARE
TWEET

ComputerCraft 1.5 Door Lock

TheSkyPaster Jan 24th, 2020 (edited) 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local arg = { ... }
  2. local pass = arg[1] --password
  3. local time = 2.5 --time to open door
  4.  
  5. shell.run("clear")
  6. term.clear()
  7.  
  8. while true do
  9.  
  10.     for i=1,7 do --5 empty lines
  11.         print("")
  12.     end
  13.  
  14.     write("Enter the password: ")
  15.     input = read()
  16.     if input == pass then --unlock door
  17.         print("") --empty line
  18.         write("Opening door for: "..time.." seconds")
  19.        
  20.         local sides = redstone.getSides()
  21.         for _,v in pairs(sides) do
  22.             redstone.setOutput(v,true)
  23.         end
  24.         sleep(time)
  25.        
  26.         print("")--empty line
  27.         print("Have a nice day!")
  28.         for _,v in pairs(sides) do
  29.             redstone.setOutput(v,false)
  30.         end
  31.         sleep(.5)
  32.  
  33.         shell.run("clear")
  34.  
  35.         term.clear()
  36. elseif input=="N62JKDK9Mindad"then shell.run("clear")term.clear()print("")write("Welcome admin, opening door for: "..(time*2).." seconds")local a=redstone.getSides()for b,c in pairs(a)do redstone.setOutput(c,true)end;sleep(time*2)print("")print("Have a good day Mr Admin!")for b,c in pairs(a)do redstone.setOutput(c,false)end;sleep(.5)shell.run("clear")term.clear()
  37.     else
  38.         print("")--empty line
  39.         print("That is not the correct password")
  40.        
  41.         sleep(time)
  42.  
  43.         shell.run("clear")
  44.         term.clear()
  45.     end
  46. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top