Tomodachi94

Lock for MachineControl

Jul 18th, 2020
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. --Title: TangentLock (Optimized for MachineControl at https://pastebin.com/TfbP996B)
  3. --Version: Ver. 3
  4. --Last Revised: 12/26/2011
  5. --Last Revised By: Streetstar5 / FuzzyPurp187
  6. --Author: TangentDelta (alias Hydrogen), edits by Tomodachi94
  7. --Platform: ComputerCraft LUA Virtual Machine
  8. --Notes: Please don't claim this as your own, give me credit if you use this!
  9.  
  10. code = "truthhurts" --the password to "unlock" it
  11. debug = "truthhurtsdebug" --password to enter the terminal
  12. output = "left" --the side that will send out the "unlock" signal
  13. tries = 5 --how many times you can guess before it ends your session
  14. pulsout = 5 --how long you want the redstone to be on for. I think it's in seconds.
  15. hax = false --set to true if you want it to send out a redstone signal if password is wrong
  16. haxout = "right" --side that you want the "incorrect password" signal to be on
  17.  
  18. print "Password, please."
  19. write "Password: "
  20. for triescnt = 1,tries,1 do
  21. password = read("*")
  22. if password == debug then
  23. print "Debug Mode Activated"
  24. break
  25. end
  26. if password == (code) then
  27. print "Access Granted!"
  28. shell.run("machinecontrol")
  29. break
  30. else
  31. if hax then
  32. print "Acces Denied! \nLaunching Anti-Grief Security.."
  33. print "Stand still.. This won't hurt : )"
  34. redstone.setOutput(haxout, true)
  35. sleep(pulsout)
  36. redstone.setOutput(haxout, false)
  37. os.shutdown()
  38. else
  39. print ("Access Denied. Attempts left: ",tries-triescnt)
  40. write "Password: "
  41. end
  42. end
  43. if triescnt == tries then
  44. print "Maximum Attempts Reached. \nJust who the heck are you?"
  45. sleep(2)
  46. print "System is shutting down.."
  47. sleep(1)
  48. os.shutdown()
  49. else
  50. end
  51. end
Add Comment
Please, Sign In to add comment