Advertisement
doublequestionmark

Yet Another Door Lock

Jun 20th, 2014
745
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1.  
  2.  
  3. DoorSide = "right" --Side Of Computer The Door Is On
  4. OpenTime = 5 --Ammount Of Seconds The Door Is Open
  5. FailuresAllowed = 3 -- Ammount Of Times The Password Can Be Incorrect
  6. Password = "ChangeMe" --Change The Text But Leave The Quotes
  7.  
  8. -- Dont Change The Following Variables
  9. os.pullEvent = os.pullEventRaw
  10. FailedAttempts = 0
  11.  
  12. function CheckForgivness()
  13. if fs.exists("NoForgivness") then
  14. term.setBackgroundColor(colors.red)
  15. term.clear()
  16. term.setCursorPos(1, 1)
  17. print("")
  18. print("No Forgivness For You")
  19. sleep(15)
  20. print("Furbies Are Evil")
  21. sleep(.5)
  22. fs.delete("NoForgivness")
  23. Main()
  24. else
  25. Main()
  26. end
  27. end
  28. function Open()
  29. rs.setOutput(DoorSide, true)
  30. sleep(OpenTime)
  31. rs.setOutput(DoorSide, false)
  32. Main()
  33. end
  34.  
  35. function Main()
  36. term.setBackgroundColor(colors.gray)
  37. term.clear()
  38. term.setCursorPos(1, 1)
  39. print("Enter Your Password To Open The Door")
  40. write("> ")
  41. input = read("|")
  42. if input == Password then
  43. print("Password Correct, Opening Door")
  44. Open()
  45. Main()
  46. else
  47. FailedAttempts = FailedAttempts + 1
  48. if FailedAttempts == FailuresAllowed then
  49. term.setBackgroundColor(colors.red)
  50. term.clear()
  51. term.setCursorPos(1, 1)
  52. cf = fs.open("NoForgivness", "w")
  53. cf.write("Hello Everyone")
  54. cf.close()
  55.  
  56. print("You Have Used All Your Attempts On")
  57. print(" Incorrect Passwords ")
  58. print("")
  59. print(" Now You Must Wait For Forgivness" )
  60. sleep(10)
  61. FailedAttempts = 0
  62. fs.delete("NoForgivness")
  63. Main()
  64. else
  65. print("Incorrect Password")
  66. print("The Failed Attempts Is Now At "..FailedAttempts)
  67. sleep(3)
  68. Main()
  69. end
  70. end
  71. end
  72. CheckForgivness()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement