Advertisement
TangentDelta

TangentLock Ver. 3

Dec 26th, 2011
7,534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.65 KB | None | 0 0
  1. --Title: TangentLock
  2. --Version: Ver. 3
  3. --Last Revised: 12/26/2011
  4. --Last Revised By: TangentDelta (alias Hydrogen)
  5. --Author: TangentDelta (alias Hydrogen)
  6. --Platform: ComputerCraft LUA Virtual Machine
  7. --Notes: Please don't claim this as your own, give me credit if you use this!
  8.  
  9. code = "password" --the password to "unlock" it
  10. debug = "debug" --password to enter the terminal
  11. output = "left" --the side that will send out the "unlock" signal
  12. tries = 5 --how many times you can guess before it ends your session
  13. pulsout = 5 --how long you want the redstone to be on for. I think it's in seconds.
  14. hax = true --set to true if you want it to send out a redstone signal if password is wrong
  15. haxout = "right" --side that you want the "incorrect password" signal to be on
  16.  
  17. print "TangentLock Ver. 3 Initialized" --please don't edit/remove this. I put alot of time into this lock, and this is my signature on it.
  18. write "Password: "
  19. for triescnt = 1,tries,1 do
  20.  password = read()
  21.  if password == debug then
  22.   print "Debug Activated"
  23.   break
  24.  end
  25.   if password == (code) then
  26.    print "Password Correct. Ending Session"
  27.    redstone.setOutput(output, true)
  28.    sleep(pulsout)
  29.    redstone.setOutput(output, false)
  30.    os.shutdown()
  31.   else
  32.     if hax then
  33.      print "Incorrect Password!"
  34.      redstone.setOutput(haxout, true)
  35.      sleep(pulsout)
  36.      redstone.setOutput(haxout, false)
  37.      os.shutdown()
  38.     else
  39.     print ("Password Incorrect. Tries left: ",tries-triescnt)
  40.     write "Password: "
  41.    end
  42.   end
  43.  if triescnt == tries then
  44.   print "Maximum Tries Reached."
  45.   sleep(2)
  46.   print "shutting Down"
  47.   sleep(1)
  48.   os.shutdown()
  49.   else
  50.  end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement