Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.35 KB | None | 0 0
  1.  
  2. --[To be used with this http://pastebin.com/exm7HRhr]--
  3.  
  4. --[At line 14 and 15, replace User/Pass with what you want]--
  5.  
  6.  
  7. --[[Settings]]--
  8. local waitDelay = 2
  9.  
  10. --[[Init]]--
  11. local silos = {}
  12. peripheral.find("modem", rednet.open)
  13.  
  14.  
  15. --[[Functions]]--
  16. local accounts = {
  17. ["Andrew2070"] = "3765", --Replace User1 with your Username, and password1 with your password
  18. ["User2"] = "password2"
  19.  
  20. }
  21.  
  22. local function clear()
  23. term.clear()
  24. term.setCursorPos(1, 1)
  25. end
  26.  
  27. term.setBackgroundColor(colors.blue)
  28. clear()
  29.  
  30.  
  31. local function red()
  32. term.setBackgroundColor(colors.red)
  33. print(" ")
  34. term.setBackgroundColor(colors.blue)
  35. end
  36.  
  37.  
  38. local function findSilos()
  39. rednet.broadcast("ping silo")
  40.  
  41. local timerID = os.startTimer(waitDelay)
  42.  
  43. while true do
  44. event, id, msg, distance = os.pullEvent()
  45.  
  46. if event == "rednet_message" and msg == "pong" then
  47. table.insert(silos, id)
  48. timerID = os.startTimer(waitDelay)
  49. elseif event == "timer" and id == timerID then
  50. return
  51. end
  52. end
  53. end
  54.  
  55. local curSilo = 1
  56. local function launch(count, x, y, z)
  57. local msg = {x = x, y = y, z = z}
  58. print("Launching @ " .. x .. ", " .. y .. ", " .. z)
  59. for i = 1, count do
  60. sleep(1)
  61. rednet.send(silos[curSilo], msg)
  62. curSilo = (curSilo == #silos) and 1 or (curSilo + 1)
  63. sleep(5)
  64. end
  65. end
  66.  
  67. local function printSilos()
  68. clear()
  69. red()
  70. print(" [Detected Silos] ")
  71. for k, v in ipairs(silos) do
  72. print(" silo #" .. k .. " id = "..v)
  73. end
  74. red()
  75. end
  76.  
  77. --[[Main program]]--
  78. local valid
  79. red()
  80. print(" Skynet Defense Systems Active ")
  81. red()
  82. print(" [Strategic Air Command] ")
  83. red()
  84. write("Enter Username: ")
  85. local input_user = read()
  86. write("Enter Password: ")
  87. local input_pass = read("*")
  88.  
  89. for valid_user, valid_pass in pairs(accounts) do
  90. if (input_user == valid_user and input_pass == valid_pass) then valid = true end
  91. end
  92.  
  93. if valid then
  94. term.clear()
  95. print(" Welcome General " ..input_user)
  96.  
  97. findSilos()
  98. while true do
  99. printSilos()
  100. red()
  101.  
  102. print(" [Launch Verification] ")
  103. red()
  104. print(" Enter Verification Code: ")
  105. red()
  106. write(" Verification Code: ")
  107. input = read()
  108. term.setBackgroundColor(colors.blue)
  109. if input == "exit" then
  110. break
  111. elseif input == "949-854-3444" then
  112. while true do
  113. sleep(1)
  114. red()
  115. print(" Confirm launch? [Yes/No] ")
  116. red()
  117. write(" >")
  118. input2 = read()
  119. if input == "No" then
  120. os.reboot()
  121. elseif input2 == "Yes" then
  122. term.clear()
  123. term.setCursorPos(1,1)
  124. local count, x, y, z
  125. while not (type(count) == "number" and type(x) == "number" and type(y) == "number" and type(z) == "number") do
  126. red()
  127. print(" [Target Selection] ")
  128. red()
  129. write(" Missile Count: ")
  130. count = tonumber(read())
  131. print("Enter Strike Coordinates:")
  132. write("X: ")
  133. x = tonumber(read())
  134. write("Y: ")
  135. y = tonumber(read())
  136. write("Z: ")
  137. z = tonumber(read())
  138. red()
  139. end
  140.  
  141. term.clear()
  142. term.setCursorPos(1,1)
  143.  
  144. red()
  145. print(" [Strategic Air Command] ")
  146. print(" Target selection complete")
  147. red()
  148. print(" Launching in T-Minus 10 ")
  149. sleep(1)
  150. print(" 9 Seconds to Launch ")
  151. sleep(1)
  152. print(" 8 Seconds to Launch ")
  153. sleep(1)
  154. print(" 7 Seconds to Launch ")
  155. sleep(1)
  156. print(" 6 Seconds to Launch ")
  157. sleep(1)
  158. print(" 5 Seconds to Launch ")
  159. sleep(1)
  160. print(" 4 Seconds to Launch ")
  161. sleep(1)
  162. print(" 3 Seconds to Launch ")
  163. sleep(1)
  164. print(" 2 Seconds to Launch ")
  165. sleep(1)
  166. print(" 1 Seconds to Launch ")
  167. sleep(1)
  168. red()
  169. print(" Do you wish to Abort [Y/N]? ")
  170. red()
  171. write(" Do you wish to Abort [Y/N]: ")
  172. local abort = read()
  173. if abort == "Yes" then
  174. os.reboot()
  175. elseif abort == "No" then
  176. launch(count, x, y, z)
  177. sleep(12)
  178. os.reboot()
  179. end
  180. os.reboot()
  181. end
  182. end
  183. end
  184. end
  185.  
  186. else print("Access Denied")
  187. print("Rebooting System")
  188. os.reboot()
  189. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement