16.03.2014, 03:54
Try to remove the "nearest object" code, so it will remove all, like this:
Note with code above: if there are no barricades created, the message "HQ: All barricades has been destroyed" will still showing, to prevent this, add an if statement and check if there is any barricades.
pawn Код:
CMD:destroyallcades(playerid, params[])
{
if(CheckGMX(playerid)) return 1;
if(IsACop(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_GREY, "You must be on foot to use this command.");
return 1;
}
if(PlayerInfo[playerid][pRank] < 3 && PlayerInfo[playerid][pFaction] != 2)
{
SendClientMessage(playerid, COLOR_GREY, "You need to be at least rank 3 to use this command.");
return 1;
}
new string[128], Float:Position[3];
for(new i; i<MAX_BARRICADES; i++)
{
DestroyDynamicObject(Barricade[i]);
}
format(string, sizeof(string), "HQ: All barricades has been destroyed by %s", GetPlayerNameEx(playerid));
foreach(Player, x)
{
if(IsACop(x))
{
SendClientMessage(x, TEAM_BLUE_COLOR, string);
}
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You're not a law enforcement officer.");
}
return 1;
}