burnin_aura

[CC] [Launch Server] [FOOTBALL]

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