Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #define Msg SendClientMessage
- #define COLOR_ERROR 0xAA3333AA
- #define COLOR_NOTIFICATION 0x33CCFFAA
- #define Bomb_Price 10000
- #define Max_Bombs 1
- #define Bomb_Radius 20
- #define Bomb_Time 15000
- new
- PlantedBomb[MAX_PLAYERS],
- Float:BombX[MAX_PLAYERS],
- Float:BombY[MAX_PLAYERS],
- Float:BombZ[MAX_PLAYERS],
- PlayerBombs[MAX_PLAYERS],
- PlayerBombObject[MAX_PLAYERS],
- Text3D:PlayerBombText[MAX_PLAYERS],
- VehicleExplode[MAX_PLAYERS],
- RemoteVehicle[MAX_PLAYERS];
- forward Bombing(playerid);
- forward CarExplosion(playerid);
- #define FILTERSCRIPT
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" -TwinkiDaBoss bombing system!");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- #endif
- CMD:plantremote(playerid,params[])
- {
- new string[128], vid = GetPlayerVehicleID(playerid);
- if(!IsPlayerInAnyVehicle(playerid))
- return Msg(playerid,COLOR_ERROR,"You are not inside any vehicle!");
- if(PlayerBombs[playerid] == 0)
- return Msg(playerid,COLOR_ERROR,"You dont have any bombs to plant!");
- if(PlantedBomb[playerid] >= 1)
- return Msg(playerid,COLOR_ERROR,"You have already planted a bomb! Wait for it to explode first!");
- PlantedBomb[playerid] = 1;
- PlayerBombs[playerid] -= 1;
- RemoteVehicle[playerid] = vid;
- format(string,sizeof(string),"You have planted a remote bomb inside vehicle ID:%i.",vid);
- Msg(playerid,COLOR_NOTIFICATION,string);
- return true;
- }
- CMD:explode(playerid,params[])
- {
- new string[128],Float:x,Float:y,Float:z;
- GetVehiclePos(RemoteVehicle[playerid],x,y,z);
- if(PlantedBomb[playerid] == 0)
- return Msg(playerid,COLOR_ERROR,"You havent planted any bombs");
- if(!IsPlayerInRangeOfPoint(playerid,50.0,x,y,z))
- return Msg(playerid,COLOR_ERROR,"You are not near the vehicle! You must be atleast 50 meters from it!");
- PlantedBomb[playerid] -= 1;
- CreateExplosion(x,y,z,10,Bomb_Radius);
- format(string,sizeof(string),"You have successfully blew up vehicle ID:%i using your remote!",RemoteVehicle[playerid]);
- Msg(playerid,COLOR_NOTIFICATION,string);
- return true;
- }
- CMD:carbomb(playerid,params[])
- {
- new string[128], Calctime, vid = GetPlayerVehicleID(playerid);
- if(!IsPlayerInAnyVehicle(playerid))
- return Msg(playerid,COLOR_ERROR,"You are not inside any vehicle!");
- if(PlayerBombs[playerid] == 0)
- return Msg(playerid,COLOR_ERROR,"You dont have any bombs to plant!");
- if(PlantedBomb[playerid] >= 1)
- return Msg(playerid,COLOR_ERROR,"You have already planted a bomb! Wait for it to explode first!");
- PlantedBomb[playerid] = 1;
- PlayerBombs[playerid] -= 1;
- Calctime = Bomb_Time/1000;
- VehicleExplode[playerid] = vid;
- SetTimerEx("CarExplosion",Bomb_Time,false,"i",playerid);
- format(string,sizeof(string),"You have placed a bomb inside vehicle ID: %i and it will explode in %i seconds",vid,Calctime);
- Msg(playerid,COLOR_NOTIFICATION,string);
- return true;
- }
- public CarExplosion(playerid)
- {
- new Float:x,Float:y,Float:z,string[128];
- GetVehiclePos(VehicleExplode[playerid],x,y,z);
- CreateExplosion(x,y,z,10,Bomb_Radius);
- format(string,sizeof(string),"Your target vehicle ID: %i has exploded!",VehicleExplode[playerid]);
- Msg(playerid,COLOR_NOTIFICATION,string);
- PlantedBomb[playerid] = 0;
- return true;
- }
- CMD:plantbomb(playerid,params[])
- {
- new Float:x,Float:y,Float:z,string[128], Calctime;
- if(IsPlayerInAnyVehicle(playerid))
- return Msg(playerid,COLOR_ERROR,"You must be on foot to do this!");
- if(PlayerBombs[playerid] == 0)
- return Msg(playerid,COLOR_ERROR,"You dont have any bombs to plant!");
- if(PlantedBomb[playerid] >= 1)
- return Msg(playerid,COLOR_ERROR,"You have already planted a bomb! Wait for it to explode first!");
- GetPlayerPos(playerid,x,y,z);
- BombX[playerid] = x;
- BombY[playerid] = y;
- BombZ[playerid] = z;
- PlantedBomb[playerid] = 1;
- PlayerBombs[playerid] -= 1;
- SetTimerEx("Bombing",Bomb_Time,false,"i",playerid);
- PlayerBombObject[playerid] = CreateObject(1252,x,y,z,0,0,0,0);
- Calctime = Bomb_Time/1000;
- format(string,sizeof(string),"You have planted a bomb! It will explode in %i seconds!",Calctime);
- Msg(playerid,COLOR_NOTIFICATION,string);
- format(string,sizeof(string),"%s's Bombs\nExplosion time: %i seconds",GetName(playerid),Calctime);
- PlayerBombText[playerid] = Create3DTextLabel(string, 0x008080FF, x,y,z, 40.0, 0, 0);
- return true;
- }
- public Bombing(playerid)
- {
- CreateExplosion(BombX[playerid],BombY[playerid],BombZ[playerid],10,Bomb_Radius);
- BombX[playerid] = 0;
- BombY[playerid] = 0;
- BombZ[playerid] = 0;
- PlantedBomb[playerid] = 0;
- DestroyObject(PlayerBombObject[playerid]);
- Delete3DTextLabel(PlayerBombText[playerid]);
- Msg(playerid,COLOR_NOTIFICATION,"Bomb has successfully exploded!");
- return true;
- }
- CMD:buybomb(playerid,params[])
- {
- new string[128];
- format(string,sizeof(string),"You already have %i bombs. You can have maximum of %i bombs!",PlayerBombs[playerid],Max_Bombs);
- if(PlayerBombs[playerid] >= Max_Bombs)
- return Msg(playerid,COLOR_ERROR,string);
- format(string,sizeof(string),"You dont have enough money! You need %i$ to buy a bomb!", Bomb_Price);
- if(GetPlayerMoney(playerid) < Bomb_Price)
- return Msg(playerid,COLOR_ERROR,string);
- PlayerBombs[playerid] += 1;
- format(string,sizeof(string),"You have purchased a bomb for %i$",Bomb_Price);
- Msg(playerid,COLOR_NOTIFICATION,string);
- GivePlayerMoney(playerid, -Bomb_Price);
- return true;
- }
- stock GetName(playerid)
- {
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- return pName;
- }
Advertisement
Add Comment
Please, Sign In to add comment