Advertisement
SolWarriorDjango

Advanced ComputerCraft Door Lock

Mar 24th, 2014
1,881
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. --[ Code written by SolWarriorDjango ]--
  2. --[ An advanced redstone door lock for the ComputerCraft Minecraft mod. Can be used on any CC computer ]--
  3.  
  4. --[ SIDE -> Replace with the side that you want the redstone signal to be emitted ]--
  5. --[ PASSWORD -> Replace with your password, can be changed later ]--
  6. --[ DEBUGPASSWORD -> Replace with a password to use a back boor ]--
  7.  
  8. os.pullEvent = os.pullEventRaw              --[ Prevents closing the program with Ctrl+T ]--
  9. term.clear()
  10. term.setCursorPos(1,1)
  11.  
  12. password = "PASSWORD"                   --[ Sets the password ]--
  13. debug = "DEBUGPASSWORD"                 --[ Sets debugging password ]--
  14. write("Password: ")
  15. input = read("*")                   --[ Input the password ]--
  16.  
  17. term.clear()                        --[ Clearing the terminal, and... ]--
  18. term.setCursorPos(1,1)                  --[ ...THEN setting the cursor position ]--
  19. if input == password then
  20.         print("Password Accepted!")     --[ If the input is correct! ]--
  21.         rs.setOutput("SIDE",true)       --[ Change this and the setOutput to the side the door is on ]--
  22.         sleep(2)  --Pause for 2 seconds
  23.         rs.setOutput("SIDE",false)
  24.         os.shutdown()               --[ Shut down the computer ]--
  25. elseif input == debug then
  26.         exit()                  --[ Exits the program ]--
  27. else
  28.         print("Password Denied!")       --[ If the input is incorrect! (Oh No!) ]--
  29.         sleep(2)
  30.         os.shutdown()               --[ Shut down the computer ]--
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement