invalid array size (negative, zero or out of bounds)
#1

Hi i want to optimise my code, but i have error with this code how i can solved my error?

PHP код:
new MAXNUMBERTEAMID;
    foreach(new 
Player)
    {
        if(
gLogged[i])
        {
            if(
MAXNUMBERTEAMID PlayerInfo[i][pTeamId] && PlayerInfo[i][pTeamId] > 0MAXNUMBERTEAMID PlayerInfo[i][pTeamId];
        }
    }
    new 
TeamConnected[MAXNUMBERTEAMID+1];// error is here 
Reply
#2

Try declaring it with a size.

pawn Код:
#define MAX_NUMBERTEAMID 249 //above your code provided.
Hope it helped. If it didnt sorry.
Reply
#3

You can't dynamically initialize arrays in this manner.
Reply
#4

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
Try declaring it with a size.

pawn Код:
#define MAX_NUMBERTEAMID 249 //above your code provided.
Hope it helped. If it didnt sorry.
Thanks but don't work

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
You can't dynamically initialize arrays in this manner.
How i can do this?
Reply
#5

I don't really see the need for it with what your trying to do.
Reply
#6

Beacause i want to calculate the number at all team in game and i use 1 loop on a loop it's too much

PHP код:
new COUNTMYTEAM,CountOtherTeam[MAX_PLAYERS],MAXINTEAM;
    foreach(new 
Player)
    {
        if(
gLogged[i])
        {
            if(
PlayerInfo[i][pTeamId] > && GetPlayerTeam(i) == CLAN+PlayerInfo[i][pTeamId])
            {
                if(
PlayerInfo[i][pTeamId] == PlayerInfo[playerid][pTeamId]) COUNTMYTEAM++;
                foreach(new 
Player)
                {
                    if(
gLogged[e])
                    {
                        if(
PlayerInfo[e][pTeamId] == PlayerInfo[i][pTeamId] && PlayerInfo[e][pTeamId] != PlayerInfo[playerid][pTeamId]) CountOtherTeam[e]++;
                        if(
MAXINTEAMCountOtherTeam[e]) MAXINTEAMCountOtherTeam[e];
                    }
                }
            }
        }
    }
       if(
COUNTMYTEAM 1)
       {
          
// code...
        
}
    return 
1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)