Advertisement
Guest User

CarBomb 2.0 ENG

a guest
Feb 14th, 2012
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.52 KB | None | 0 0
  1. /* CarBomb by Godoy32 FOR SA-MP FORUM */
  2. #include <a_samp>
  3. #include <ZCMD>
  4. #define Precio 50000
  5. new Bomba[MAX_PLAYERS];
  6. new BombaA[MAX_VEHICLES];
  7.  
  8. public OnFilterScriptInit()
  9. {
  10.     for(new i = 0; i < MAX_PLAYERS; i++)
  11.     {
  12.         Bomba[i]=0;
  13.     }
  14.     for(new i = 0; i < MAX_VEHICLES; i++)
  15.     {
  16.         BombaA[i]=-1;
  17.     }
  18. }
  19. public OnPlayerDisconnect(playerid,reason)
  20. {
  21.     Bomba[playerid]=0;
  22.     for(new i = 0; i < MAX_VEHICLES; i++)
  23.     {
  24.         if(BombaA[i]==playerid)
  25.         {
  26.             BombaA[i]=-1;
  27.         }
  28.     }
  29. }
  30. public OnPlayerConnect(playerid)
  31. {
  32.     Bomba[playerid]=0;
  33.     for(new i = 0; i < MAX_VEHICLES; i++)
  34.     {
  35.         if(BombaA[i]==playerid)
  36.         {
  37.             BombaA[i]=-1;
  38.         }
  39.     }
  40. }
  41. COMMAND:bi(playerid,parms[])
  42. {
  43.     new  q = 0;
  44.     if(Bomba[playerid]==2)
  45.     {
  46.         new st[128];
  47.         for(new i = 0; i < MAX_PLAYERS; i++)
  48.         {
  49.             if(IsPlayerInAnyVehicle(i))
  50.             {
  51.                 for(new o = 0; o < MAX_VEHICLES; o++)
  52.                 {
  53.                     if(BombaA[o]==playerid)
  54.                     {
  55.                         if(IsPlayerInVehicle(i,o))
  56.                         {
  57.                             new pName[24];
  58.                             GetPlayerName(i,pName,24);
  59.                             format(st,24+5+4,"%s (%d)",pName,i);
  60.                             SendClientMessage(playerid,-1,st);
  61.                             q++;
  62.                         }
  63.                     }
  64.                 }
  65.             }
  66.         }
  67.     }
  68.     else return SendClientMessage(playerid,-1,"You need to buy a bomb");
  69.     if(q==0) return SendClientMessage(playerid,-1,"There's nobody in the car");
  70.     return 1;
  71.  }
  72. COMMAND:bomb(playerid,params[])
  73. {
  74.     if(Bomba[playerid]==0)
  75.     {
  76.         if(Precio <= GetPlayerMoney(playerid))
  77.         {
  78.             if(IsPlayerInRangeOfPoint(playerid,30,-1676.87,406.17,6.72))
  79.             {
  80.                 SendClientMessage(playerid,0x00FF00FF,"You bought a bomb - Use /bomb to put it in a car");
  81.                 GivePlayerMoney(playerid,-Precio);
  82.                 Bomba[playerid]=1;
  83.                 return 1;
  84.             }
  85.             else return SendClientMessage(playerid,0xFF0000FF,"You are not close to fuel station (SF)");
  86.          }
  87.          else return SendClientMessage(playerid,0xFF0000FF,"You have no money ($"#Precio")");
  88.     }
  89.     if(Bomba[playerid]==1)
  90.     {
  91.         if(IsPlayerInAnyVehicle(playerid))
  92.         {
  93.             new a = GetPlayerVehicleID(playerid);
  94.             SendClientMessage(playerid,0x00FF00FF,"Bomb placed successfully, use /bomb to detonate it");
  95.             BombaA[a]=playerid;
  96.             Bomba[playerid]=2;
  97.             return 1;
  98.         }
  99.         else return SendClientMessage(playerid,0xFF0000FF,"You are not in a car");
  100.     }
  101.     if(Bomba[playerid]==2)
  102.     {
  103.         new q=0;
  104.         for(new i = 0; i < MAX_PLAYERS; i++)
  105.         {
  106.             if(IsPlayerInAnyVehicle(i))
  107.             {
  108.                 for(new o = 0; o < MAX_VEHICLES; o++)
  109.                 {
  110.                     if(BombaA[o]==playerid)
  111.                     {
  112.                         if(IsPlayerInVehicle(i,o))
  113.                         {
  114.                             q++;
  115.                             new Float:X,Float:Y,Float:Z;
  116.                             GetPlayerPos(o,X,Y,Z);
  117.                             CreateExplosion(X,Y,Z,12,15.0);
  118.                             CreateExplosion(X,Y,Z,10,15.0);
  119.                             CallRemoteFunction("OnPlayerDeath","ddd",i,playerid,40);
  120.                         }
  121.                     }
  122.                 }
  123.             }
  124.         }
  125.         new st[128 char];
  126.         format(st,128,"%d players died in the car bomb",q);
  127.         SendClientMessage(playerid,0x00FF00FF,st);
  128.         Bomba[playerid]=0;
  129.         for(new i = 0; i < MAX_VEHICLES; i++)
  130.         {
  131.             if(BombaA[i]==playerid)
  132.             {
  133.                 new Float:X, Float:Y, Float:Z;
  134.                 GetVehiclePos(i,X,Y,Z);
  135.                 CreateExplosion(X,Y,Z,12,15.0);
  136.                 CreateExplosion(X,Y,Z,10,15.0);
  137.                 SendClientMessage(playerid,0x00FF00FF,"Bomb Exploted");
  138.                 BombaA[i]=-1;
  139.             }
  140.         }
  141.     }
  142.     return 1;
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement