Erreur log
#1

Hello guys, i have one error and i don't see here is the problem.

Can you help me plz ?

Thx


error:
Код:
#0 00042abc in public TextNom () from lsrp.amx
[21:36:56] [debug] Run time error 4: "Array index out of bounds"
[21:36:56] [debug]  Accessing element at index 500 past array upper bound 499
[21:36:56] [debug] AMX backtrace:
[21:36:56] [debug] #0 00042abc in public TextNom () from lsrp.amx
[21:36:56] [debug] Run time error 4: "Array index out of bounds"
[21:36:56] [debug]  Accessing element at index 500 past array upper bound 499
[21:36:56] [debug] AMX backtrace:
And my fonction:
PHP код:
public TextNom()
{
    for(new 
i<= MAX_PLAYERSi++)
    {
        for(new 
j<= MAX_PLAYERSj++)
        {
              new 
string[256];
            if(
aDuty[j])
            {
                   new 
IP[15];
                new 
Float:Health;
                
GetPlayerHealth(i,Health);
                new 
Float:Armor;
                
GetPlayerArmour(i,Armor);
                
GetPlayerIp(iIPsizeof(IP));
                
DeletePlayer3DTextLabel(j,PlayerText3D:Nom[j][i]);
                
format(string,sizeof(string),"%s (%d)\nVie: %0.0f\nArmure: %0.0f\nIP: %s",NameUnder(i),i,Health,Armor,IP);
                
Nom2[j][i] = CreatePlayer3DTextLabel(j,string,COLOR_WHITE,0.0,0.0,0.3,40.0,i);
            }
            else
            {
                   
DeletePlayer3DTextLabel(j,PlayerText3D:Nom2[j][i]);
                
format(string,sizeof(string),"Inconnu (%d)",PlayerInfo[i][pNumAleatoire]);
                
Nom[j][i] = CreatePlayer3DTextLabel(j,string,COLOR_WHITE,0.0,0.0,0.1,10.0,i);
            }
        }
    }
    return 
1;

Thanks for your help.
Reply
#2

nobody can help me ?
Reply
#3

Firstly, why are you running two loops? Secondly, - you need to verify the player is connected.

pawn Код:
public TextNom()
{
    for(new i; i <= MAX_PLAYERS; i++)
    {
       if(!IsPlayerConnected(i)) continue;
              new string[256];
            if(aDuty[j])
            {
                   new IP[15];
                new Float:Health;
                GetPlayerHealth(i,Health);
                new Float:Armor;
                GetPlayerArmour(i,Armor);
                GetPlayerIp(i, IP, sizeof(IP));
                DeletePlayer3DTextLabel(j,PlayerText3D:Nom[j][i]);
                format(string,sizeof(string),"%s (%d)\nVie: %0.0f\nArmure: %0.0f\nIP: %s",NameUnder(i),i,Health,Armor,IP);
                Nom2[j][i] = CreatePlayer3DTextLabel(j,string,COLOR_WHITE,0.0,0.0,0.3,40.0,i);
            }
            else
            {
                   DeletePlayer3DTextLabel(j,PlayerText3D:Nom2[j][i]);
                format(string,sizeof(string),"Inconnu (%d)",PlayerInfo[i][pNumAleatoire]);
                Nom[j][i] = CreatePlayer3DTextLabel(j,string,COLOR_WHITE,0.0,0.0,0.1,10.0,i);
            }
    }
    return 1;
}
Reply
#4

of this

pawn Код:
for(new i; i <= MAX_PLAYERS; i++)
put it in

pawn Код:
for(new i; i < MAX_PLAYERS; i++)
Reply
#5

Ok thx i testing that !
Reply
#6

Quote:
Originally Posted by sensi
Посмотреть сообщение
Ok thx i testing that !
did that work?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)