How to set this into /destroyallcades?
#9

Quote:
Originally Posted by Robo_N1X
Посмотреть сообщение
Also check my previous post, i edited the code.
Did you checked my previous post?

Quote:
Originally Posted by Robo_N1X
Посмотреть сообщение
Hmm no, because i can't see how Barricade[] is defined, perhaps you can count how many objects were deleted, by checking if the object is valid, like this:
pawn Код:
new x = 0;
for(new i; i<MAX_BARRICADES; i++)
{
    if(IsValidDynamicObject(Barricade[i]))
    {
        DestroyDynamicObject(Barricade[i]);
        x++;
    }
}
if(x > 0)
{
        foreach(Player, x)
        {
            if(IsACop(x))
            {
                SendClientMessage(x, TEAM_BLUE_COLOR, string);
            }
        }

}
else
{
    SendClientMessage(playerid, COLOR_GREY, "There is no barricade to destroy!");
}
Not tested yet, hope it works.
Also i've saw your Barricade[] code, so you can check by using:
pawn Код:
if(Barricade[i] != 0)
on code above, replace the IsValidDynamicObject(Barricade[i]).
But i would recommend my previous code above, with IsValidDynamicObject...
You can either use:
pawn Код:
if(IsValidDynamicObject(Barricade[i]))
or
pawn Код:
if(IsValidDynamicObject(Barricade[i]) && Barricade[i] != 0)
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)