- enum boom
- {// I scripted that in 30mins XDDD
- Float: bombx,
- Float: bomby,
- Float: bombz,
- plantedby,
- object,
- invehicle
- }
- new Bomb[50][boom];
- new plantedbombs=0;
- OnGameModeInit
- {
- for(new b=0; b<=50; b++)
- {
- Bomb[b][bombx]=0.0;
- Bomb[b][bomby]=0.0;
- Bomb[b][bombz]=0.0;
- Bomb[b][plantedby]=-1;
- Bomb[b][object]=-1;
- Bomb[b][invehcile]=0;
- }
- }
- OnPlayerDisconnect
- {
- if(PlayerTemp[playerid][bombid]!= -1)
- {
- new b = PlayerTemp[playerid][bombid];
- Bomb[b][bombx]=0.0;
- Bomb[b][bomby]=0.0;
- Bomb[b][bombz]=0.0;
- Bomb[b][plantedby]=-1;
- Bomb[b][object]=-1;
- Bomb[b][invehcile]=0;
- plantedbombs--;
- }
- }
- if(strcmp(cmd,"/givebomb",true) == 0)
- {
- if(PlayerInfo[playerid][power] > 2)
- {
- new tmp[256];
- tmp = strtok(cmdtext,idx);
- if(!strlen(tmp))
- {
- SendClientUsage(playerid,cmd,"[playerid/PartOfName]");
- return 1;
- }
- new target = ReturnUser(tmp);
- if(IsPlayerConnected(target))
- {
- new stringa[MAX_STRING];
- PlayerTemp[target][bomb]=true;
- format(stringa,sizeof(stringa),"Admin %s gave you bomb",PlayerName(playerid));
- SendClientInfo(target,stringa);
- format(stringa,sizeof(stringa),"You gave bomb to %s",PlayerName(target));
- SendClientInfo(playerid,stringa);
- return 1;
- } else SendClientError(playerid,"This player is not connected");
- }
- return 1;
- }
- if(strcmp(cmd,"/plantbomb",true) == 0)
- {
- if(PlayerTemp[playerid][bomb]==true)
- {
- new tmp[256];
- tmp = strtok(cmdtext,idx);
- if(!strlen(tmp))
- {
- SendClientUsage(playerid,cmd,"[ground/car]");
- return 1;
- }
- if(strcmp(tmp,"ground",true) == 0)
- {
- if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
- {
- if(plantedbombs > 50) return SendClientError(playerid,"Max bombs already planted");
- new Float: X, Float: Y, Float: Z;
- GetPlayerPos(playerid,X,Y,Z);
- plantedbombs++;
- Bomb[plantedbombs][object]=CreateObject(1654, X, Y, Z-0.9, 0, 90, 0);
- Bomb[plantebombs][bombx]=X;
- Bomb[plantedbombs][bomby]=Y;
- Bomb[plantedbombs[bombz]=Z;
- Bomb[plantedbombs][plantedby]=playerid;
- Bomb[plantedbombs][invehicle]=0;
- PlayerTemp[playerid][bombid]=plantedbombs;
- PlayerTemp[playerid][bomb]=false;
- printf("%s planted bomb at %.2f %.2f %.2f on ground",PlayerName(playerid),X,Y,Z);
- SendClientInfo(playerid,"Bomb planted");
- return 1;
- } else SendClientError(playerid,"You are not on feet");
- }
- else if(strcmp(tmp,"car",true) == 0)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- if(plantedbombs > 50) return SendClientError(playerid,"Max bombs already planted");
- plantedbombs++;
- Bomb[plantedbombs][invehicle]=GetPlayerVehicleID(playerid);
- PlayerTemp[playerid][bombid]=plantedbombs;
- PlayerTemp[playerid][bomb]=false;
- printf("%s planted bomb in car %d",PlayerName(playerid),GetPlayerVehicleID(playerid));
- SendClientInfo(playerid,"Bomb planted");
- return 1;
- } else SendClientError(playerid,"You are not in vehicle");
- }
- } else SendClientError(playerid,"You don't have any bomb");
- }
- if(strcmp(cmd,"/activatebomb",true) == 0)
- {
- if(PlayerTemp[playerid][bombid]!=-1)
- {
- new bombid = PlayerTemp[playerid][bombid];
- if(Bomb[bombid][invehicle] == 0)
- {
- CreateExplosion(Bomb[bombid][bombx],Bomb[bombid][bomby],Bomb[bombid][bombz],7, 10);
- Bomb[bombid][bombx]=0.0;
- Bomb[bombid][bomby]=0.0;
- Bomb[bombid][bombz]=0.0;
- DestroyObject(Bomb[bombid][obect]);
- Bomb[bombid][plantedby]=-1;
- bombid=-1;
- plantedbombs--;
- SendClientInfo(playerid,"Bomb activated");
- return 1;
- }
- else
- {
- new Float: X, Float: Y, Float: Z;
- GetVehiclePos(Bomb[bombid][invehicle],X,Y,Z);
- CreateExplosion(X,Y,Z,7, 10);
- Bomb[bombid][invehicle]=0;
- bombid=-1;
- plantedbombs--;
- SendClientInfo(playerid,"Bomb activated");
- return 1;
- }
- } else SendClientError(playerid,"You didn't plant any bomb");
- }
- if(strcmp(cmd,"/plantedby",true) == 0)
- {
- if(PlayerInfo[playerid][power]>2)
- {
- new stringa[MAX_STRING];
- for(new b=0; b<=50; b++)
- {
- if(IsPlayerInSphere(playerid,Bomb[b][bombx],Bomb[b][bomby],Bomb[b][bombz],3)
- {
- format(stringa,sizeof(stringa),"Bombid: %d - Plantedby: %s - Vehicle: %d",b,PlayerName(Bomb[b][plantedby]),Bomb[b][invehicle]);
- SendClientInfo(playerid,stringa);
- return 1;
- }
- }
- }
- return 1;
- }
- //I WILL EDIT /FRISKCAR COMMAND
- if(strcmp(cmd,"/defusebomb",true) == 0)
- {
- new message[MAX_STRING];
- for(new b=0; b<=50; b++)
- {
- if(Bomb[b][invehicle] == 0)
- {
- if(IsPlayerInSphere(playerid,Bomb[b][bombx],Bomb[b][bomby],Bomb[b][bombz],3)
- {
- new rand=random(100);
- if((rand > 70 && (PlayerInfo[playerid][playerteam] != SASF || PlayerInfo[playerid][playerteam] != COPS))
- || rand > 60 && (PlayerInfo[playerid][playerteam] == SASF || PlayerInfo[playerid][playerteam] == COPS))
- {
- format(message,sizeof(message),"%s tries to defuse bomb and fail",PlayerName(playerid));
- NearMessage(playerid,message,COLOR_RED);
- CreateExplosion(Bomb[b][bombx],Bomb[b][bomby],Bomb[b][bombz],7, 10);
- Bomb[b][bombx]=0.0;
- Bomb[b][bomby]=0.0;
- Bomb[b][bombz]=0.0;
- DestroyObject(Bomb[b][obect]);
- PlayerTemp[Bomb[b][plantedby][bombid]=-1;
- Bomb[b][plantedby]=-1;
- plantedbombs--;
- return 1;
- }
- else
- {
- format(message,sizeof(message),"%s tries to defuse bomb and succeed",PlayerName(playerid));
- NearMessage(playerid,message,COLOR_GREEN);
- Bomb[b][bombx]=0.0;
- Bomb[b][bomby]=0.0;
- Bomb[b][bombz]=0.0;
- DestroyObject(Bomb[b][obect]);
- PlayerTemp[Bomb[b][plantedby][bombid]=-1;
- Bomb[b][plantedby]=-1;
- plantedbombs--;
- return 1;
- }
- }
- }
- else
- {
- if(PlayerTemp[playerid][foundbomb]==true)
- {
- new rand=random(100);
- if((rand > 70 && (PlayerInfo[playerid][playerteam] != SASF || PlayerInfo[playerid][playerteam] != COPS))
- || rand > 60 && (PlayerInfo[playerid][playerteam] == SASF || PlayerInfo[playerid][playerteam] == COPS))
- {
- format(message,sizeof(message),"%s tries to defuse bomb and fail",PlayerName(playerid));
- NearMessage(playerid,message,COLOR_RED);
- new Float: X, Float: Y, Float: Z;
- GetVehiclePos(Bomb[b][invehicle],X,Y,Z);
- CreateExplosion(X,Y,Z,7, 10);
- PlayerTemp[Bomb[b][plantedby][bombid]=-1;
- Bomb[b][plantedby]=-1;
- Bomb[b][invehicle]=0;
- plantedbombs--;
- return 1;
- }
- else
- {
- format(message,sizeof(message),"%s tries to defuse bomb and succeed",PlayerName(playerid));
- NearMessage(playerid,message,COLOR_GREEN);
- new Float: X, Float: Y, Float: Z;
- GetVehiclePos(Bomb[b][invehicle],X,Y,Z);
- PlayerTemp[Bomb[b][plantedby][bombid]=-1;
- Bomb[b][plantedby]=-1;
- Bomb[b][invehicle]=0;
- plantedbombs--;
- return 1;
- }
- }
- else SendClientError(playerid,"You haven't found any bomb");
- }
- }
- return 1;
- }
