Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* CarBomb by Godoy32 FOR SA-MP FORUM */
- #include <a_samp>
- #include <ZCMD>
- #define Precio 50000
- new Bomba[MAX_PLAYERS];
- new BombaA[MAX_VEHICLES];
- public OnFilterScriptInit()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- Bomba[i]=0;
- }
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- BombaA[i]=-1;
- }
- }
- public OnPlayerDisconnect(playerid,reason)
- {
- Bomba[playerid]=0;
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- if(BombaA[i]==playerid)
- {
- BombaA[i]=-1;
- }
- }
- }
- public OnPlayerConnect(playerid)
- {
- Bomba[playerid]=0;
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- if(BombaA[i]==playerid)
- {
- BombaA[i]=-1;
- }
- }
- }
- COMMAND:bi(playerid,parms[])
- {
- new q = 0;
- if(Bomba[playerid]==2)
- {
- new st[128];
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerInAnyVehicle(i))
- {
- for(new o = 0; o < MAX_VEHICLES; o++)
- {
- if(BombaA[o]==playerid)
- {
- if(IsPlayerInVehicle(i,o))
- {
- new pName[24];
- GetPlayerName(i,pName,24);
- format(st,24+5+4,"%s (%d)",pName,i);
- SendClientMessage(playerid,-1,st);
- q++;
- }
- }
- }
- }
- }
- }
- else return SendClientMessage(playerid,-1,"You need to buy a bomb");
- if(q==0) return SendClientMessage(playerid,-1,"There's nobody in the car");
- return 1;
- }
- COMMAND:bomb(playerid,params[])
- {
- if(Bomba[playerid]==0)
- {
- if(Precio <= GetPlayerMoney(playerid))
- {
- if(IsPlayerInRangeOfPoint(playerid,30,-1676.87,406.17,6.72))
- {
- SendClientMessage(playerid,0x00FF00FF,"You bought a bomb - Use /bomb to put it in a car");
- GivePlayerMoney(playerid,-Precio);
- Bomba[playerid]=1;
- return 1;
- }
- else return SendClientMessage(playerid,0xFF0000FF,"You are not close to fuel station (SF)");
- }
- else return SendClientMessage(playerid,0xFF0000FF,"You have no money ($"#Precio")");
- }
- if(Bomba[playerid]==1)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- new a = GetPlayerVehicleID(playerid);
- SendClientMessage(playerid,0x00FF00FF,"Bomb placed successfully, use /bomb to detonate it");
- BombaA[a]=playerid;
- Bomba[playerid]=2;
- return 1;
- }
- else return SendClientMessage(playerid,0xFF0000FF,"You are not in a car");
- }
- if(Bomba[playerid]==2)
- {
- new q=0;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerInAnyVehicle(i))
- {
- for(new o = 0; o < MAX_VEHICLES; o++)
- {
- if(BombaA[o]==playerid)
- {
- if(IsPlayerInVehicle(i,o))
- {
- q++;
- new Float:X,Float:Y,Float:Z;
- GetPlayerPos(o,X,Y,Z);
- CreateExplosion(X,Y,Z,12,15.0);
- CreateExplosion(X,Y,Z,10,15.0);
- CallRemoteFunction("OnPlayerDeath","ddd",i,playerid,40);
- }
- }
- }
- }
- }
- new st[128 char];
- format(st,128,"%d players died in the car bomb",q);
- SendClientMessage(playerid,0x00FF00FF,st);
- Bomba[playerid]=0;
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- if(BombaA[i]==playerid)
- {
- new Float:X, Float:Y, Float:Z;
- GetVehiclePos(i,X,Y,Z);
- CreateExplosion(X,Y,Z,12,15.0);
- CreateExplosion(X,Y,Z,10,15.0);
- SendClientMessage(playerid,0x00FF00FF,"Bomb Exploted");
- BombaA[i]=-1;
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement