Problem with a loop
#1

I dont understand this, as i create the gang, it creates 30 gangs at the same time:

pawn Код:
CMD:gcreate(playerid,params[])
{
    if(playerGang[playerid]>0)
        return SendClientMessage(playerid, -1, ""COL_RED"ERROR:{FFFFFF} You are already in a gang.");
    if(sscanf(params,"s[16]",params[0]))
        return SendClientMessage(playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /gcreate <gangname> (Max 16 char)");
    new string[128];
    for(new i = 1; i < MAX_GANGS; i++)
    {
        if(gangInfo[i][0]==0)
        {
            //name gang
            format(gangNames[i], MAX_GANG_NAME, "%s", params[0]);
            //Gang exists
            gangInfo[i][0]=1;
            //There is one member
            gangInfo[i][1]=1;
            //Gang color is player's color
            gangInfo[i][2]=PlayerColors[playerid];
            //Player is the first gang member
            gangMembers[i][0] = playerid;
            format(string, sizeof(string),"You have created the gang '%s' (id: %d)", gangNames[i], i);
            SendClientMessage(playerid, COLOR_GREEN, string);
            playerGang[playerid]=i;
        }
    }
    return 1;
}
I know it has something to do with the loop, but why is it working
perfectly at the old landgrab gamemodes? Its the same code.
Anyone could take a look at it and tell me whats wrong?
Thanks, regards.
Reply


Messages In This Thread
Problem with a loop - by OldDirtyBastard - 28.02.2011, 11:52
Re: Problem with a loop - by JaTochNietDan - 28.02.2011, 11:55
Re: Problem with a loop - by OldDirtyBastard - 28.02.2011, 11:58
Re: Problem with a loop - by JaTochNietDan - 28.02.2011, 12:00
Re: Problem with a loop - by OldDirtyBastard - 28.02.2011, 12:18
Re: Problem with a loop - by OldDirtyBastard - 28.02.2011, 12:27

Forum Jump:


Users browsing this thread: 1 Guest(s)