Advertisement
chezpaul

DoorLock

Oct 13th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. --Title: TangentLock
  2. --Version: Ver. 4
  3. --Last Revised: 1/6/2012
  4. --Last Revised By: TangentDelta (alias Hydrogen)
  5. --Author: TangentDelta (alias Hydrogen)
  6. --Platform: ComputerCraft LUA Virtual Machine
  7.  
  8. right = "elivion"
  9. debug = "debug"
  10. outputface = "right"
  11. protectmode = true
  12. protectside = "left"
  13. opentime = 5
  14. maxtries = 3
  15. tries = 0
  16. hint = "for debugging purposes"
  17. function TangentLock()
  18. password()
  19. if user == debug then
  20. print "Leaving SecureLock. Entering CraftOS"
  21. shell.run"shell"
  22. end
  23. if user == right then
  24. print "Password Correct"
  25. correct()
  26. end
  27. if user == "credits" then
  28. print "TangentLock Version 4.0"
  29. print "A program by TangentDelta"
  30. sleep(10)
  31. TangentLock()
  32. end
  33. if user == "hint" then
  34. print (hint)
  35. sleep(5)
  36. end
  37. if not(user == right) or (user == debug) or (user == "credits") or (user == "hint") then
  38. if tries == maxtries -1 then
  39. if protectmode then
  40. protect()
  41. else
  42. print "Too Many Wrong Tries"
  43. print "Shutting Down Now"
  44. sleep (3)
  45. os.shutdown()
  46. end
  47. else
  48. print "Incorrect Password."
  49. tries = tries+1
  50. print ("Tries Left: ", maxtries - tries)
  51. sleep(5)
  52. TangentLock()
  53. end
  54. end
  55. end
  56. function correct()
  57. sleep(1)
  58. shell.run("clear")
  59. rs.setOutput(outputface, true)
  60. sleep(opentime)
  61. rs.setOutput(outputface, false)
  62. os.shutdown()
  63. end
  64. function protect()
  65. rs.setOutput(protectside, true)
  66. sleep(1)
  67. rs.setOutput(protectside, false)
  68. os.shutdown()
  69. end
  70. function password()
  71. shell.run("clear")
  72. print ("SecureLock 4.0 Running On Computer ", os.getComputerID())
  73. write "Password: "
  74. user=io.read()
  75. end
  76. TangentLock()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement