Guest User

FloodGate V1.1

a guest
Feb 16th, 2012
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.63 KB | None | 0 0
  1. --Title: FloodGate
  2. --Version: Ver. 1.1
  3. --Last Revised: 2/15/2012
  4. --Author: MattTheIdler
  5.  
  6. pass = "password"
  7. debug = "debug"
  8. outside = "back"
  9. hint = "Hint"
  10.  
  11. function menu()
  12. while true do
  13. term.clear()
  14. term.setCursorPos(1,1)
  15. textutils.slowPrint "Main Menu"
  16. print "\n1. Open Gate"
  17. print "2. Close Gate"
  18. print "3. Exit"
  19. event, param = os.pullEvent()
  20. if event == "char" and param1 == "1" then open() end
  21. if event == "char" and param1 == "2" then close() end
  22. if event == "char" and param1 == "3" then break end
  23. end
  24. end
  25.  
  26. function correct()
  27. term.clear()
  28. term.setCursorPos(1,1)
  29. textutils.slowPrint "Correct Password."
  30. print "\nAccessing Main Menu..."
  31. sleep(1)
  32. menu()
  33. end
  34.  
  35. function password()
  36. term.clear()
  37. term.setCursorPos(1,1)
  38. textutils.slowPrint "FloodGate 1.1"
  39. write ("\nPassword: ")
  40. user = io.read()
  41. end
  42.  
  43. function open()
  44. term.clear()
  45. term.setCursorPos(1,1)
  46. textutils.slowPrint "Flooding..."
  47. sleep(1)
  48. rs.setOutput(outside, true)
  49. print "\nDone."
  50. sleep(1)
  51. menu()
  52. end
  53.  
  54. function close()
  55. term.clear()
  56. term.setCursorPos(1,1)
  57. textutils.slowPrint "Closing..."
  58. sleep(1)
  59. rs.setOutput(outside, false)
  60. print "\nDone."
  61. sleep(1)
  62. menu()
  63. end
  64.  
  65. password()
  66. if user == debug then
  67. term.clear()
  68. term.setCursorPos(1,1)
  69. textutils.slowPrint "Accessing OS..."
  70. sleep(1)
  71. shell.run"shell"
  72. end
  73. if user == pass then
  74. correct()
  75. end
  76. if user == "hint" then
  77. term.clear()
  78. term.setCursorPos(1,1)
  79. textutils.slowPrint "Hint:"
  80. print (hint)
  81. sleep(2)
  82. password()
  83. end
  84. if not(user == pass) or (user == debug) or (user == "hint") then
  85. term.clear()
  86. term.setCursorPos(1,1)
  87. textutils.slowPrint "Incorrect Password."
  88. sleep(1)
  89. password()
  90. end
Advertisement
Add Comment
Please, Sign In to add comment