Help me fixing this. Please.
#3

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
pawn Код:
CMD:explodeall(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
        foreach(new i : Player)
        {
            if(PlayerInfo[i][pAdmin] >= 1)
            {
                return 1;
            }
            new Float:x, Float:y, Float:z;
            GetPlayerPos(i, x, y, z);
            CreateExplosion(x, y, z, 12, 10.0);
            SendFMessage(i, -1, "%s %s has exploded all players online!", GetAdminLevel(playerid), Name(playerid));
        }
    }
    else
    {
        SendClientMessage(playerid, -1, NO_PERM);
    }
    return 1;
}
That will fix the error but it won't work properly, what he did there is when the loop finds an admin; it will stop because he returned.
Try this:
pawn Код:
CMD:explodeall(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
        foreach(new i : Player)
        {
            if(PlayerInfo[i][pAdmin] >= 1)continue;
            new Float:x, Float:y, Float:z;
            GetPlayerPos(i, x, y, z);
            CreateExplosion(x, y, z, 12, 10.0);
            SendFMessage(i, -1, "%s %s has exploded all players online!", GetAdminLevel(playerid), Name(playerid));
        }
    }
    else
    {
        SendClientMessage(playerid, -1, NO_PERM);
    }
    return 1;
}
Reply


Messages In This Thread
Help me fixing this. Please. - by Magic_Time - 12.07.2013, 19:43
Re: Help me fixing this. Please. - by DobbysGamertag - 12.07.2013, 19:45
Re: Help me fixing this. Please. - by DaRk_RaiN - 12.07.2013, 19:59

Forum Jump:


Users browsing this thread: 2 Guest(s)