How to set this into /destroyallcades?
#2

Try to remove the "nearest object" code, so it will remove all, like this:
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;
}
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.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)