Share Pastebin
Guest
Public paste!

LDTLuxurY

By: a guest | Mar 14th, 2009 | Syntax: C++ | Size: 17.63 KB | Hits: 373 | Expires: Never
Copy text to clipboard
  1. /*
  2. ================================================================================
  3. |          Title: LuxurY Bomb Explosion (Bomb shop + Lots of bomb commands)    |
  4. |          Version: 0.1.3                                                      |
  5. |          Date: 22 august 2007                                                |
  6. |          Creator: LuxurY                                                     |
  7. |          Language: English                                                   |
  8. |                                                                              |
  9. | (c) LuxurY scripts 2007                                                      |
  10. ================================================================================
  11. ________________________________________________________________________________
  12.  
  13.                                888
  14.                                  88
  15.                                  88
  16.                               88[ ]88
  17.                              8888[ ]8888
  18.                            8888888[ ]88888
  19.                          8888888888[ ]888888   88
  20.                     8888888888888888[ ]888888888
  21.                    88    8888888888[ ]888888
  22.                            8888888[ ]88888
  23.                              8888[ ]8888
  24.                               88[ ]88
  25.                                 88
  26.                                 88
  27.                                  888
  28.  
  29. ________________________________________________________________________________
  30. */
  31. //includes
  32. #include <a_samp>
  33. #include <dini>
  34.  
  35. //color defines
  36. #define COLOR_GREY 0xAFAFAFAA
  37. #define COLOR_GREEN 0x33AA33AA
  38. #define COLOR_RED 0xAA3333AA
  39. #define COLOR_YELLOW 0xFFFF00AA
  40. #define COLOR_WHITE 0xFFFFFFAA
  41. #define COLOR_BLUE 0x0000BBAA
  42. #define COLOR_LIGHTBLUE 0x33CCFFAA
  43. #define COLOR_ORANGE 0xFF9900AA
  44.  
  45. //filterscript configuration
  46. new statusfs[10] = { "v.0.1.3" };
  47. new allowbomb;
  48.  
  49. //player statuses
  50. new bombarea[MAX_PLAYERS];
  51. new Float:Xbombb[MAX_PLAYERS];
  52. new Float:Ybombb[MAX_PLAYERS];
  53. new Float:Zbombb[MAX_PLAYERS];
  54. new curvplt[MAX_PLAYERS];
  55. new curvpld[MAX_PLAYERS];
  56. new allowtoport[MAX_PLAYERS];
  57. new timebomb[MAX_PLAYERS];
  58. new bombid[MAX_PLAYERS];
  59.  
  60. //vehicles statuses
  61. new bombhave[MAX_VEHICLES];
  62. new bombt[MAX_VEHICLES];
  63. new bombd[MAX_VEHICLES];
  64.  
  65. //forwards
  66. forward BombCheck();
  67. forward AreaCheck();
  68. forward AllowBomb();
  69. forward Tport();
  70.  
  71. public OnFilterScriptInit()
  72. {
  73.         print("\n----------------------------------");
  74.         printf("  Bomb Explosion %s by LuxurY",statusfs);
  75.         print("----------------------------------\n");
  76.         SetTimer("AreaCheck",1000,1);
  77.         SetTimer("BombCheck",2000,1);
  78.         SetTimer("AllowBomb",1000,1);
  79.         SetTimer("Tport",120000,1);
  80.         allowbomb = 0;
  81.         return 1;
  82. }
  83.  
  84. stock IsPlayerInCubeArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy, Float:minz, Float:maxz)
  85. {
  86.         new
  87.                 Float:x,
  88.                 Float:y,
  89.                 Float:z;
  90.         GetPlayerPos(playerid, x, y, z);
  91.         if (x > minx && x < maxx && y > miny && y < maxy && z > minz && z < maxz) return 1;
  92.         return 0;
  93. }
  94.  
  95. stock GetDistanceBetweenVehicles(v1,v2)
  96. {
  97.         new
  98.                 Float:x1,
  99.                 Float:y1,
  100.                 Float:z1,
  101.                 Float:x2,
  102.                 Float:y2,
  103.                 Float:z2,
  104.                 Float:tmpdis;
  105.         GetVehiclePos(v1,x1,y1,z1);
  106.         GetVehiclePos(v2,x2,y2,z2);
  107.         tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
  108.         return floatround(tmpdis);
  109. }
  110.  
  111. stock GetDistanceBetweenVAP(playerid,v)
  112. {
  113.         new
  114.                 Float:x1 = Xbombb[playerid],
  115.                 Float:y1 = Ybombb[playerid],
  116.                 Float:z1 = Zbombb[playerid],
  117.                 Float:x2,Float:y2,Float:z2,
  118.                 Float:tmpdis;
  119.         GetVehiclePos(v,x2,y2,z2);
  120.         tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
  121.         return floatround(tmpdis);
  122. }
  123.        
  124. stock GiveVehicleHealth(vehicleid,Float:heal)
  125. {
  126.         new
  127.                 Float:vh;
  128.         GetVehicleHealth(vehicleid,vh);
  129.         SetVehicleHealth(vehicleid,vh+heal);
  130.         return 1;
  131. }
  132.  
  133. public OnPlayerSpawn(playerid)
  134. {
  135.         Xbombb[playerid] = 0;
  136.         Ybombb[playerid] = 0;
  137.         Zbombb[playerid] = 0;
  138.         bombarea[playerid] = 1;
  139.         curvplt[playerid] = 999;
  140.         curvpld[playerid] = 999;
  141.         allowtoport[playerid] = 1;
  142.         if (bombid[playerid] == 0)
  143.         {
  144.         }
  145.         else
  146.         {
  147.                 DestroyObject(bombid[playerid]);
  148.         }
  149.         bombid[playerid] = 0;
  150.         return 1;
  151. }
  152.  
  153. public OnPlayerCommandText(playerid, cmdtext[])
  154. {
  155.         new tmp[255];
  156.         new playername[24];
  157.         GetPlayerName(playerid,playername,sizeof(playername));
  158.         new cmd[256], idx;
  159.         cmd = strtok(cmdtext, idx);
  160.         new Float:X, Float:Y, Float:Z;
  161.         new VID = GetPlayerVehicleID(playerid);
  162.  
  163.         if(strcmp(cmd, "/bombcmd", true) == 0)
  164.         {
  165.         SendClientMessage(playerid, COLOR_YELLOW, "=========== LuxurY Bomb Explosion Commands ===========");
  166.         SendClientMessage(playerid, COLOR_YELLOW, " /killb - kill youself with bomb");
  167.         SendClientMessage(playerid, COLOR_YELLOW, " /bt - to create timer on vehicle");
  168.         SendClientMessage(playerid, COLOR_YELLOW, " /bd - to create detomator on vehicle");
  169.         SendClientMessage(playerid, COLOR_YELLOW, " /cb - to create bomb on place");
  170.         SendClientMessage(playerid, COLOR_YELLOW, " /dv - to activate detomator on vehicle");
  171.         SendClientMessage(playerid, COLOR_YELLOW, " /db - to explose bomb");
  172.         SendClientMessage(playerid, COLOR_YELLOW, " To deactivate: /ccb - bomb /cct - timer /ccd - detonator");
  173.         SendClientMessage(playerid, COLOR_YELLOW, " /bs - teleport to the Bomb Shop");
  174.         SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________________________________");
  175.                 return 1;
  176.         }
  177.         if(strcmp(cmd, "/abombcmd", true) == 0)
  178.         {
  179.         SendClientMessage(playerid, COLOR_YELLOW, "=========== LuxurY Bomb Explosion Commands Admin ===========");
  180.         SendClientMessage(playerid, COLOR_YELLOW, " /setbt [playerid] [time] [0(no) or 1(yes)] - to create timer on player's vehicle");
  181.         SendClientMessage(playerid, COLOR_YELLOW, " /setbd [playerid] [0(no) or 1(yes)] - to create detonator on player's vehicle");
  182.         SendClientMessage(playerid, COLOR_YELLOW, " /explose [playerid] - explose player");
  183.         SendClientMessage(playerid, COLOR_YELLOW, " /abomb - allow/disallow automatically creating bombs on vehicles");
  184.         SendClientMessage(playerid, COLOR_YELLOW, " /setbombv [playerid] - to create bomb on player's vehicle");
  185.         SendClientMessage(playerid, COLOR_YELLOW, "____________________________________________________________________");
  186.                 return 1;
  187.         }
  188.         if(strcmp(cmd, "/bt", true) == 0)
  189.         {
  190.                 if (bombhave[VID] == 1)
  191.                 {
  192.                         new time;
  193.                         tmp = strtok(cmdtext, idx);
  194.                         if(!strlen(tmp))
  195.                         {
  196.                                 SendClientMessage(playerid, 0xFFFFFFAA, "Usage: /bt [time]");
  197.                                 return 1;
  198.                         }
  199.                         time = strval(tmp);
  200.                         curvplt[playerid] = VID;
  201.                         bombt[VID] = 1;
  202.                         timebomb[playerid] = time;
  203.                         bombhave[VID] = 0;
  204.                         SendClientMessage(playerid, 0xFFFFFFAA, "Timer has been activated. To cancel type /cct");
  205.                         SetTimer("BombCheck",2000,1);
  206.                 }
  207.                 else
  208.                 {
  209.                         SendClientMessage(playerid,COLOR_RED,"There is no bomb on you vehicle!");
  210.                 }
  211.                 return 1;
  212.         }
  213.        
  214.         if(strcmp(cmd, "/setbt", true) == 0)
  215.         {
  216.                 new time, plidd, boolt;
  217.                 tmp = strtok(cmdtext, idx);
  218.                 new pliddv = GetPlayerVehicleID(plidd);
  219.                 if(!strlen(tmp))
  220.                 {
  221.                         SendClientMessage(playerid, 0xFFFFFFAA, "Usage: /setbt [playerid] [time] [0 or 1]");
  222.                         return 1;
  223.                 }
  224.                 plidd = strval(tmp);
  225.                 tmp = strtok(cmdtext, idx);
  226.                 if(!strlen(tmp))
  227.                 {
  228.                         SendClientMessage(playerid, 0xFFFFFFAA, "Usage: /setsbt [playerid] [time] [0 or 1]");
  229.                         return 1;
  230.                 }
  231.                 time = strval(tmp);
  232.                 tmp = strtok(cmdtext, idx);
  233.                 if(!strlen(tmp))
  234.                 {
  235.                         SendClientMessage(playerid, 0xFFFFFFAA, "Usage: /setsbt [playerid] [time] [0 or 1]");
  236.                         return 1;
  237.                 }
  238.                 boolt = strval(tmp);
  239.                 if(IsPlayerAdmin(playerid))
  240.                 {
  241.                         if(IsPlayerInAnyVehicle(plidd))
  242.                         {
  243.                                 curvplt[playerid] = pliddv;
  244.                                 bombt[pliddv] = boolt;
  245.                                 timebomb[plidd] = time;
  246.                         }
  247.                         else
  248.                         {
  249.                                 SendClientMessage(playerid,COLOR_RED,"This player is not in vehicle!");
  250.                         }
  251.                 }
  252.                 else
  253.                 {
  254.                         SendClientMessage(playerid,0xFF0000AA,"You are not an admin!");
  255.                 }
  256.                 return 1;
  257.         }
  258.        
  259.         if(strcmp(cmd, "/setbd", true) == 0)
  260.         {
  261.                 new boold, plidd;
  262.                 tmp = strtok(cmdtext, idx);
  263.                 new pliddv = GetPlayerVehicleID(plidd);
  264.                 if(!strlen(tmp))
  265.                 {
  266.                         SendClientMessage(playerid, 0xFFFFFFAA, "Usage: /setbd [playerid] [0 or 1]");
  267.                         return 1;
  268.                 }
  269.                 plidd = strval(tmp);
  270.                 tmp = strtok(cmdtext, idx);
  271.                 if(!strlen(tmp))
  272.                 {
  273.                         SendClientMessage(playerid, 0xFFFFFFAA, "Usage: /setsbd [playerid] [0 or 1]");
  274.                         return 1;
  275.                 }
  276.                 boold = strval(tmp);
  277.                 if(IsPlayerAdmin(playerid))
  278.                 {
  279.                         if(IsPlayerInAnyVehicle(plidd))
  280.                         {
  281.                                 curvplt[playerid] = pliddv;
  282.                                 bombd[pliddv] = boold;
  283.                         }
  284.                         else
  285.                         {
  286.                                 SendClientMessage(playerid,COLOR_RED,"This player is not in vehicle!");
  287.                         }
  288.                 }
  289.                 else
  290.                 {
  291.                         SendClientMessage(playerid,0xFF0000AA,"You are not an admin!");
  292.                 }
  293.                 return 1;
  294.         }
  295.        
  296.         if(strcmp(cmd, "/bd", true) == 0)
  297.         {
  298.                 if (bombhave[VID] == 1)
  299.                 {
  300.                         GetVehiclePos(VID,X,Y,Z);
  301.                         bombd[VID] = 1;
  302.                         curvpld[playerid] = VID;
  303.                         bombhave[VID] = 0;
  304.                         SendClientMessage(playerid, 0xFFFFFFAA, "Detomator has been activated. To cancel type /ccd");
  305.                 }
  306.                 else
  307.                 {
  308.                         SendClientMessage(playerid,COLOR_RED,"There is no bomb on you vehicle!");
  309.                 }
  310.                 return 1;
  311.         }
  312.        
  313.         if(strcmp(cmd, "/dv", true) == 0)
  314.         {
  315.                 if(curvpld[playerid] == 999)
  316.                 {
  317.                         SendClientMessage(playerid,COLOR_RED,"You didn't create detomator on vehicle!");
  318.                 }
  319.                 else
  320.                 {
  321.                         GetVehiclePos(curvpld[playerid],X,Y,Z);
  322.                         SetVehicleHealth(curvpld[playerid],0);
  323.                         CreateExplosion(X,Y,Z,6,2);
  324.                         CreateExplosion(X,Y,Z,7,2);
  325.                         SendClientMessage(playerid, 0xFFFFFFAA, "Vehicle has been explosed");
  326.                         for (new v = 1; v < MAX_VEHICLES; v++)
  327.                         {
  328.                                 new dis = GetDistanceBetweenVehicles(curvpld[playerid],v);
  329.                                 if (dis < 5)
  330.                                 {
  331.                                         SetVehicleHealth(v,0);
  332.                                 }
  333.                                 else if (dis > 5 && dis < 10)
  334.                                 {
  335.                                         GiveVehicleHealth(v,-650);
  336.                                 }
  337.                                 else if (dis > 10 && dis < 15)
  338.                                 {
  339.                                         GiveVehicleHealth(v,-300);
  340.                                 }
  341.                         }
  342.                 }
  343.                 return 1;
  344.         }
  345.        
  346.         if(strcmp(cmd, "/killb", true) == 0)
  347.         {
  348.                 GetPlayerPos(playerid,X,Y,Z);
  349.                 if (IsPlayerInAnyVehicle(playerid))
  350.                 {
  351.                         CreateExplosion(X,Y,Z,6,2);
  352.                         CreateExplosion(X,Y,Z,7,2);
  353.                         SetVehicleHealth(VID,0);
  354.                 }
  355.                 else
  356.                 {
  357.                         SetPlayerHealth(playerid,10);
  358.                         CreateExplosion(X,Y,Z,6,2);
  359.                         CreateExplosion(X,Y,Z,7,2);
  360.                         SendClientMessage(playerid, 0xFFFFFFAA, "You explosed.");
  361.                 }
  362.                 return 1;
  363.         }
  364.        
  365.         if(strcmp(cmd, "/cb", true) == 0)
  366.         {
  367.                 GetPlayerPos(playerid,X,Y,Z);
  368.                 Xbombb[playerid] = X;
  369.                 Ybombb[playerid] = Y;
  370.                 Zbombb[playerid] = Z;
  371.                 if (bombid[playerid] == 0)
  372.                 {
  373.                 }
  374.                 else
  375.                 {
  376.                         DestroyObject(bombid[playerid]);
  377.                 }
  378.                 bombid[playerid] = CreateObject(1252,X,Y + 0.5,Z,0,0,0);
  379.                 SendClientMessage(playerid,COLOR_GREEN,"Bomb created! To explose type /db");
  380.                 return 1;
  381.         }
  382.        
  383.         if(strcmp(cmd, "/db", true) == 0)
  384.         {
  385.                 if (Xbombb[playerid] == 0 || Ybombb[playerid] == 0 || Zbombb[playerid] == 0)
  386.                 {
  387.                         SendClientMessage(playerid,COLOR_RED,"You didn't create bomb!");
  388.                 }
  389.                 else
  390.                 {
  391.                         CreateExplosion(Xbombb[playerid],Ybombb[playerid],Zbombb[playerid],6,1);
  392.                         CreateExplosion(Xbombb[playerid],Ybombb[playerid],Zbombb[playerid],7,1);
  393.                         SendClientMessage(playerid,COLOR_GREEN,"Bomb has been explosed.");
  394.                         DestroyObject(bombid[playerid]);
  395.                         bombid[playerid] = 0;
  396.                         for (new v = 1; v < MAX_VEHICLES; v++)
  397.                         {
  398.                                 new dis = GetDistanceBetweenVAP(playerid,v);
  399.                                 if (dis < 5)
  400.                                 {
  401.                                         SetVehicleHealth(v,0);
  402.                                 }
  403.                                 else if (dis > 5 && dis < 10)
  404.                                 {
  405.                                         GiveVehicleHealth(v,-650);
  406.                                 }
  407.                                 else if (dis > 10 && dis < 15)
  408.                                 {
  409.                                         GiveVehicleHealth(v,-300);
  410.                                 }
  411.                         }
  412.                         Xbombb[playerid] = 0;
  413.                         Ybombb[playerid] = 0;
  414.                 Zbombb[playerid] = 0;
  415.                 }
  416.                 return 1;
  417.         }
  418.        
  419.         if(strcmp(cmd, "/ccb", true) == 0)
  420.         {
  421.                 if (Xbombb[playerid] == 0 || Ybombb[playerid] == 0 || Zbombb[playerid] == 0)
  422.                 {
  423.                         SendClientMessage(playerid,COLOR_YELLOW,"There is nothing to deactivate.");
  424.                 }
  425.                 else
  426.                 {
  427.                         Xbombb[playerid] = 0;
  428.                         Ybombb[playerid] = 0;
  429.                         Zbombb[playerid] = 0;
  430.                         SendClientMessage(playerid,COLOR_YELLOW,"Bomb has been deactivated.");
  431.                 }
  432.                 return 1;
  433.         }
  434.        
  435.         if(strcmp(cmd, "/cct", true) == 0)
  436.         {
  437.                 new v = curvplt[playerid];
  438.                 if (bombt[v] == 0 || curvplt[playerid] == 999)
  439.                 {
  440.                         SendClientMessage(playerid,COLOR_YELLOW,"There is nothing to deactivate.");
  441.                 }
  442.                 else
  443.                 {
  444.                         bombt[v] = 0;
  445.                         curvplt[playerid] = 999;
  446.                         SendClientMessage(playerid,COLOR_YELLOW,"Timer on vehicle has been deactivated.");
  447.                 }
  448.                 return 1;
  449.         }
  450.        
  451.         if(strcmp(cmd, "/ccd", true) == 0)
  452.         {
  453.                 new v = curvpld[playerid];
  454.                 if (bombd[v] == 0 || curvpld[playerid] == 999)
  455.                 {
  456.                         SendClientMessage(playerid,COLOR_YELLOW,"There is nothing to deactivate.");
  457.                 }
  458.                 else
  459.                 {
  460.                         bombd[v] = 0;
  461.                         curvpld[playerid] = 999;
  462.                         SendClientMessage(playerid,COLOR_YELLOW,"Detonator on vehicle has been deactivated.");
  463.                 }
  464.                 return 1;
  465.         }
  466.        
  467.         if(strcmp(cmd, "/explose", true) == 0 && IsPlayerAdmin(playerid))
  468.         {
  469.                 new plid;
  470.                 tmp = strtok(cmdtext, idx);
  471.                 if(!strlen(tmp))
  472.                 {
  473.                         SendClientMessage(playerid, COLOR_WHITE, "Usage: /explose [playerid]");
  474.                         return 1;
  475.                 }
  476.                 plid = strval(tmp);
  477.                 GetPlayerPos(plid,X,Y,Z);
  478.                 if (IsPlayerInAnyVehicle(plid))
  479.                 {
  480.                         new plidv = GetPlayerVehicleID(plid);
  481.                         SetVehicleHealth(plidv,0);
  482.                         CreateExplosion(X,Y,Z,6,2);
  483.                         CreateExplosion(X,Y,Z,7,2);
  484.                 }
  485.                 else
  486.                 {
  487.                         SetPlayerHealth(plid,10);
  488.                         CreateExplosion(X,Y,Z,6,2);
  489.                         CreateExplosion(X,Y,Z,7,2);
  490.                 }
  491.                 return 1;
  492.         }
  493.        
  494.         if(strcmp(cmd, "/abomb", true) == 0 && IsPlayerAdmin(playerid))
  495.         {
  496.                 if (allowbomb == 0)
  497.                 {
  498.                         allowbomb = 1;
  499.                         SendClientMessageToAll(COLOR_GREEN,"Now all vehicles will always have bombs");
  500.                 }
  501.                 else
  502.                 {
  503.                         allowbomb = 0;
  504.                         SendClientMessageToAll(COLOR_RED, "Bomb can be bought in Bomb Shop. To teleport type /bs");
  505.                 }
  506.                 return 1;
  507.         }
  508.        
  509.         if(strcmp(cmd, "/setbombv", true) == 0 && IsPlayerAdmin(playerid))
  510.         {
  511.                 new plid;
  512.                 tmp = strtok(cmdtext, idx);
  513.                 if(!strlen(tmp))
  514.                 {
  515.                         SendClientMessage(playerid, COLOR_WHITE, "Usage: /setbombv [playerid]");
  516.                         return 1;
  517.                 }
  518.                 plid = strval(tmp);
  519.                 GetPlayerPos(plid,X,Y,Z);
  520.                 if (IsPlayerInAnyVehicle(plid))
  521.                 {
  522.                         new plidv = GetPlayerVehicleID(plid);
  523.                         bombhave[plidv] = 1;
  524.                         }
  525.                         else
  526.                         {
  527.                                 SendClientMessage(playerid,COLOR_RED,"This player is not in vehicle!");
  528.                         }
  529.                 return 1;
  530.         }
  531.        
  532.         if(strcmp(cmdtext, "/bs", true) == 0)
  533.         {
  534.                 if (allowtoport[playerid] == 1)
  535.                 {
  536.                         if(IsPlayerInAnyVehicle(playerid))
  537.                         {
  538.                                 SetVehiclePos(VID, 1842, -1852.8, 14);
  539.                         }
  540.                         else
  541.                         {
  542.                                 SetPlayerPos(playerid, 1842, -1852.8, 14);
  543.                         }
  544.                         SetTimer("Tport",120000,1);
  545.                         allowtoport[playerid] = 0;
  546.                         }
  547.                         else
  548.                         {
  549.                                 SendClientMessage(playerid,COLOR_RED,"You can't teleport now! Please wait for a few minutes");
  550.                         }
  551.                         return 1;
  552.                 }
  553.                 return 0;
  554.         }
  555.  
  556. public BombCheck()
  557. {
  558.         for (new i = 0; i < MAX_PLAYERS; i++)
  559.         {
  560.                 if (curvplt[i] == 999)
  561.                 {
  562.                         return 1;
  563.                 }
  564.                 else
  565.                 {
  566.                         if (bombt[curvplt[i]] == 1)
  567.                         {
  568.                                 if (timebomb[i] > 0)
  569.                                 {
  570.                                         new
  571.                                                 Float:Xv,
  572.                                                 Float:Yv,
  573.                                                 Float:Zv;
  574.                                         GetVehiclePos(curvplt[i],Xv,Yv,Zv);
  575.                                         timebomb[i]--;
  576.                                         new string[255];
  577.                                         format(string,sizeof(string)," Explosion: %d",timebomb[i]);
  578.                                         SendClientMessageToAll(COLOR_RED,string);
  579.                                         if (timebomb[i] == 1)
  580.                                         {
  581.                                                 SetVehicleHealth(curvplt[i],0);
  582.                                                 CreateExplosion(Xv,Yv,Zv,6,1);
  583.                                                 CreateExplosion(Xv,Yv,Zv,7,1);
  584.                                                 for (new v = 1; v < MAX_VEHICLES; v++)
  585.                                                 {
  586.                                                         new dis = GetDistanceBetweenVehicles(curvpld[i],v);
  587.                                                         if (dis < 5)
  588.                                                         {
  589.                                                                 SetVehicleHealth(v,0);
  590.                                                         }
  591.                                                         else if (dis > 5 && dis < 10)
  592.                                                         {
  593.                                                                 GiveVehicleHealth(v,-650);
  594.                                                         }
  595.                                                         else if (dis > 10 && dis < 15)
  596.                                                         {
  597.                                                                 GiveVehicleHealth(v,-300);
  598.                                                         }
  599.                                                 }
  600.                                         }
  601.                                         else
  602.                                         {
  603.                                                 new kt = SetTimer("BombCheck",2000,1);
  604.                                                 KillTimer(kt);
  605.                                         }
  606.                                 }
  607.                         }
  608.                 }
  609.         }
  610.         return 1;
  611. }
  612.        
  613. public AreaCheck()
  614. {
  615.         for (new i=0; i < MAX_PLAYERS; i++)
  616.         {
  617.                 new v = GetPlayerVehicleID(i);
  618.                 if (IsPlayerInCubeArea(i,1843,1857,-1860,-1852.8,13,17.5))
  619.                 {
  620.                         if (bombarea[i] == 1)
  621.                         {
  622.                                 if (GetPlayerMoney(i) > 499)
  623.                                 {
  624.                                         if (IsPlayerInAnyVehicle(i))
  625.                                         {
  626.                                                 SendClientMessage(i,COLOR_GREEN,"======== Wellcome to the Bomb Shop ========");
  627.                                                 SendClientMessage(i,COLOR_GREEN,"* Bomb has been installed.");
  628.                                                 SendClientMessage(i,COLOR_GREEN,"* To create timet type /bt [time]");
  629.                                                 SendClientMessage(i,COLOR_GREEN,"* To create detomator type /bd");
  630.                                                 SendClientMessage(i,COLOR_GREEN,"* Other commands: /bombcmd");
  631.                                                 bombarea[i] = 0;
  632.                                                 bombhave[v] = 1;
  633.                                         }
  634.                                         else
  635.                                         {
  636.                                                 SendClientMessage(i,COLOR_GREEN,"You are not in vehicle!");
  637.                                                 bombarea[i] = 0;
  638.                                         }
  639.                                 }
  640.                                 else
  641.                                 {
  642.                                         SendClientMessage(i,COLOR_GREEN,"Not enough money!");
  643.                                         bombarea[i] = 0;
  644.                                 }
  645.                          }
  646.                  }
  647.                  else
  648.                  {
  649.                         bombarea[i] = 1;
  650.                 }
  651.         }
  652.         return 1;
  653. }
  654.        
  655. public AllowBomb()
  656. {
  657.         for (new i=0; i < MAX_PLAYERS; i++)
  658.         {
  659.                 if(allowbomb == 1)
  660.                 {
  661.                         new av = GetPlayerVehicleID(i);
  662.                         bombhave[av] = 1;
  663.                 }
  664.         }
  665.         return 1;
  666. }
  667.        
  668. public Tport()
  669. {
  670.         for (new i=0; i < MAX_PLAYERS; i++)
  671.         {
  672.                 if (IsPlayerConnected(i))
  673.                 {
  674.                         if (allowtoport[i] == 0)
  675.                         {
  676.                                 allowtoport[i] = 1;
  677.                         }
  678.                 }
  679.         }
  680.         return 1;
  681. }
  682.  
  683. public OnVehicleDeath(vehicleid,killerid)
  684. {
  685.         if (bombt[vehicleid] == 1)
  686.         {
  687.                 for (new v = 1; v < MAX_VEHICLES; v++)
  688.                 {
  689.                         new dis = GetDistanceBetweenVehicles(vehicleid,v);
  690.                         if (dis < 5)
  691.                         {
  692.                                 SetVehicleHealth(v,0);
  693.                         }
  694.                         else if (dis > 5 && dis < 10)
  695.                         {
  696.                                 GiveVehicleHealth(v,-650);
  697.                         }
  698.                         else if (dis > 10 && dis < 15)
  699.                         {
  700.                                 GiveVehicleHealth(v,-300);
  701.                         }
  702.                 }
  703.         }
  704.         return 1;
  705. }