Advertisement
Toreno

Nuclear Blast

Apr 12th, 2012
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.50 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. #define COLOR_RED 0xFF0606AA
  5.  
  6. #define DIALOG_NUKE (13000)
  7. #define DIALOG_YES (13001)
  8. #define DIALOG_NO (13002)
  9. #define DIALOG_DELETE (13003)
  10.  
  11. enum nbInfo
  12. {
  13.     bool:SetPosition,
  14.     Float:P[3],
  15.     Missile[2],
  16.     Smoke[12],
  17.     FlyingTimer,
  18.     bool:FlyingVar[3],
  19.     ExplodingTimer,
  20.     SmokeTimer,
  21.     bool:SmokeVar[2],
  22.     SmokeTime
  23. };
  24.  
  25. new
  26.     NuclearBlast[MAX_PLAYERS][nbInfo]
  27. ;
  28.  
  29. forward Flying(playerid);
  30. forward Exploding(playerid);
  31. forward Smoking(playerid);
  32.  
  33. public OnFilterScriptInit()
  34. {
  35.     print("\n--------------------------------------");
  36.     print(" Nuclear Blast Filterscript by Toreno");
  37.     print("--------------------------------------\n");
  38.  
  39.     return 1;
  40. }
  41.  
  42. public OnFilterScriptExit()
  43. {
  44.     for(new i; i < MAX_PLAYERS; i++)
  45.     {
  46.         for(new a; a < 2; a++)
  47.         {
  48.             DestroyObject(NuclearBlast[i][Missile][a]);
  49.         }
  50.        
  51.         for(new a; a < 12; a++)
  52.         {
  53.             DestroyObject(NuclearBlast[i][Smoke][a]);
  54.         }
  55.  
  56.         KillTimer(NuclearBlast[i][FlyingTimer]);
  57.         KillTimer(NuclearBlast[i][ExplodingTimer]);
  58.     }
  59.  
  60.     return 1;
  61. }
  62.  
  63. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  64. {
  65.     switch(dialogid)
  66.     {
  67.         case DIALOG_NUKE:
  68.         {
  69.             if(!response)
  70.             {
  71.                 return ShowPlayerDialog(playerid, DIALOG_NO, DIALOG_STYLE_MSGBOX, "{FFFFFF}MESSAGE!", "{FF0000}You have canceled sending a nuclear blast.", "Close", "");
  72.             }
  73.            
  74.             ShowPlayerDialog(playerid, DIALOG_YES, DIALOG_STYLE_MSGBOX, "{FFFFFF}MESSAGE!", "{00FF00}Well done!\r\nPositions are now known, and are ready to be sended.\r\n\r\nIn order to send, type /sendnuclearblast command, or type /delposition command to delete position, and stop it.", "Close", "");
  75.             GetPlayerPos(playerid, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2]);
  76.             NuclearBlast[playerid][SetPosition] = true;
  77.         }
  78.     }
  79.    
  80.     return 1;
  81. }
  82.  
  83.  
  84. public Flying(playerid)
  85. {
  86.     if(!NuclearBlast[playerid][FlyingVar][1])
  87.     {
  88.         MoveObject(NuclearBlast[playerid][Missile][0], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2], 50.0);
  89.         MoveObject(NuclearBlast[playerid][Missile][1], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2], 50.0);
  90.         NuclearBlast[playerid][FlyingVar][0] = false;
  91.         NuclearBlast[playerid][FlyingVar][1] = true;
  92.     }
  93.  
  94.     new
  95.         Float:GOP[3]
  96.     ;
  97.  
  98.     GetObjectPos(NuclearBlast[playerid][Missile][0], GOP[0], GOP[1], GOP[2]);
  99.  
  100.     if(GOP[0] == NuclearBlast[playerid][P][0] && GOP[1] == NuclearBlast[playerid][P][1] && GOP[2] == NuclearBlast[playerid][P][2])
  101.     {
  102.         NuclearBlast[playerid][ExplodingTimer] = SetTimerEx("Exploding", 100, false, "i", playerid);
  103.         KillTimer(NuclearBlast[playerid][FlyingTimer]);
  104.     }
  105.     return 1;
  106. }
  107.  
  108. public Exploding(playerid)
  109. {
  110.     if(!NuclearBlast[playerid][FlyingVar][0])
  111.     {
  112.         DestroyObject(NuclearBlast[playerid][Missile][0]);
  113.         DestroyObject(NuclearBlast[playerid][Missile][1]);
  114.         NuclearBlast[playerid][FlyingVar][0] = true;
  115.     }
  116.  
  117.     CreateExplosion(NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2], 6, 50.0);
  118.     CreateExplosion(NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] + 10.0, 6, 50.0);
  119.     CreateExplosion(NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] + 20.0, 6, 50.0);
  120.     CreateExplosion(NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] + 30.0, 6, 50.0);
  121.     CreateExplosion(NuclearBlast[playerid][P][0] + 15.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2], 6, 50.0);
  122.     CreateExplosion(NuclearBlast[playerid][P][0] - 15.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2], 6, 50.0);
  123.     CreateExplosion(NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] + 15.0, NuclearBlast[playerid][P][2], 6, 50.0);
  124.     CreateExplosion(NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] - 15.0, NuclearBlast[playerid][P][2], 6, 50.0);
  125.     NuclearBlast[playerid][SmokeVar][0] = false;
  126.     NuclearBlast[playerid][SmokeVar][1] = false;
  127.     NuclearBlast[playerid][SmokeTimer] = SetTimerEx("Smoking", 25, true, "i", playerid);
  128.    
  129.     return 1;
  130. }
  131.  
  132. public Smoking(playerid)
  133. {
  134.     if(!NuclearBlast[playerid][SmokeVar][0])
  135.     {
  136.         NuclearBlast[playerid][Smoke][0] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
  137.         NuclearBlast[playerid][Smoke][1] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
  138.         NuclearBlast[playerid][Smoke][2] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
  139.         NuclearBlast[playerid][Smoke][3] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
  140.         NuclearBlast[playerid][Smoke][4] = CreateObject(2780, NuclearBlast[playerid][P][0] + 7.5, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
  141.         NuclearBlast[playerid][Smoke][5] = CreateObject(2780, NuclearBlast[playerid][P][0] - 7.5, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
  142.         NuclearBlast[playerid][Smoke][6] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] + 7.5, NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
  143.         NuclearBlast[playerid][Smoke][7] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] - 7.5, NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
  144.         NuclearBlast[playerid][Smoke][8] = CreateObject(2780, NuclearBlast[playerid][P][0] + 15.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
  145.         NuclearBlast[playerid][Smoke][9] = CreateObject(2780, NuclearBlast[playerid][P][0] - 15.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
  146.         NuclearBlast[playerid][Smoke][10] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] + 15.0, NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
  147.         NuclearBlast[playerid][Smoke][11] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] - 15.0, NuclearBlast[playerid][P][2] - 2.0, 0.0, 0.0, 0.0);
  148.         NuclearBlast[playerid][SmokeVar][0] = true;
  149.     }
  150.    
  151.     if(!NuclearBlast[playerid][SmokeVar][1])
  152.     {
  153.         MoveObject(NuclearBlast[playerid][Smoke][0], NuclearBlast[playerid][P][0] + 15.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 2.5);
  154.         MoveObject(NuclearBlast[playerid][Smoke][1], NuclearBlast[playerid][P][0] - 15.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 2.5);
  155.         MoveObject(NuclearBlast[playerid][Smoke][2], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] + 15.0, NuclearBlast[playerid][P][2] - 2.0, 2.5);
  156.         MoveObject(NuclearBlast[playerid][Smoke][3], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] - 15.0, NuclearBlast[playerid][P][2] - 2.0, 2.5);
  157.         MoveObject(NuclearBlast[playerid][Smoke][4], NuclearBlast[playerid][P][0] + 17.5, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 2.5);
  158.         MoveObject(NuclearBlast[playerid][Smoke][5], NuclearBlast[playerid][P][0] - 17.5, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 2.5);
  159.         MoveObject(NuclearBlast[playerid][Smoke][6], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] + 17.5, NuclearBlast[playerid][P][2] - 2.0, 2.5);
  160.         MoveObject(NuclearBlast[playerid][Smoke][7], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] - 17.5, NuclearBlast[playerid][P][2] - 2.0, 2.5);
  161.         MoveObject(NuclearBlast[playerid][Smoke][8], NuclearBlast[playerid][P][0] + 30.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 2.5);
  162.         MoveObject(NuclearBlast[playerid][Smoke][9], NuclearBlast[playerid][P][0] - 30.0, NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] - 2.0, 2.5);
  163.         MoveObject(NuclearBlast[playerid][Smoke][10], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] + 30.0, NuclearBlast[playerid][P][2] - 2.0, 2.5);
  164.         MoveObject(NuclearBlast[playerid][Smoke][11], NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1] - 30.0, NuclearBlast[playerid][P][2] - 2.0, 2.5);
  165.         NuclearBlast[playerid][SmokeVar][1] = true;
  166.         NuclearBlast[playerid][SmokeTime] = gettime();
  167.     }
  168.  
  169.     if((gettime() - NuclearBlast[playerid][SmokeTime]) >= 10)
  170.     {
  171.         for(new i; i < 12; i++)
  172.         {
  173.             DestroyObject(NuclearBlast[playerid][Smoke][i]);
  174.         }
  175.         NuclearBlast[playerid][FlyingVar][0] = true;
  176.         NuclearBlast[playerid][FlyingVar][1] = false;
  177.         NuclearBlast[playerid][FlyingVar][2] = false;
  178.         NuclearBlast[playerid][SmokeVar][0] = true;
  179.         NuclearBlast[playerid][SmokeVar][1] = true;
  180.         KillTimer(NuclearBlast[playerid][SmokeTimer]);
  181.  
  182.     }
  183.  
  184.     return 1;
  185. }
  186.  
  187. CMD:setposition(playerid, params[])
  188. {
  189.     #pragma unused params
  190.     if(IsPlayerInAnyVehicle(playerid))
  191.     {
  192.         return SendClientMessage(playerid, COLOR_RED, "Get out of the vehicle, to get this command work properly.");
  193.     }
  194.  
  195.     ShowPlayerDialog(playerid, DIALOG_NUKE, DIALOG_STYLE_MSGBOX, "{FF0000}WARNING!", "{FFFFFF}Are you sure you want to send a nuclear blast at your current position?", "Yes", "No");
  196.    
  197.     return 1;
  198. }
  199.  
  200. CMD:delposition(playerid, params[])
  201. {
  202.     #pragma unused params
  203.  
  204.     if(!NuclearBlast[playerid][SetPosition])
  205.     {
  206.         return SendClientMessage(playerid, COLOR_RED, "You haven't set a position.");
  207.     }
  208.  
  209.     ShowPlayerDialog(playerid, DIALOG_DELETE, DIALOG_STYLE_MSGBOX, "{FFFFFF}MESSAGE!", "{FFFF00}You have deleted your position, and stopped the nuclear blast.", "Close", "");
  210.     NuclearBlast[playerid][SetPosition] = false;
  211.    
  212.     return 1;
  213. }
  214.  
  215. CMD:sendnuclearblast(playerid, params[])
  216. {
  217.     #pragma unused params
  218.  
  219.     if(!NuclearBlast[playerid][SetPosition])
  220.     {
  221.         return SendClientMessage(playerid, COLOR_RED, "You haven't set a position.");
  222.     }
  223.    
  224.     if(NuclearBlast[playerid][FlyingVar][2])
  225.     {
  226.         return SendClientMessage(playerid, COLOR_RED, "You sent a missile already, wait until it blows up.");
  227.     }
  228.    
  229.     NuclearBlast[playerid][Missile][0] = CreateObject(3786, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] + 60.0, 0.0, -90.0, 0.0);
  230.     NuclearBlast[playerid][Missile][1] = CreateObject(2780, NuclearBlast[playerid][P][0], NuclearBlast[playerid][P][1], NuclearBlast[playerid][P][2] + 61.0, 0.0, 0.0, 0.0);
  231.     NuclearBlast[playerid][FlyingVar][2] = true;
  232.     NuclearBlast[playerid][FlyingTimer] = SetTimerEx("Flying", 25, true, "i", playerid);
  233.  
  234.     return 1;
  235. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement