Erreur log - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Erreur log (
/showthread.php?tid=543007)
Error in Fonction -
sensi - 23.10.2014
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; i <= MAX_PLAYERS; i++)
{
for(new j; j <= MAX_PLAYERS; j++)
{
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;
}
Thanks for your help.
Re: Erreur log -
sensi - 24.10.2014
nobody can help me ?
Re: Erreur log -
Abagail - 24.10.2014
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;
}
Respuesta: Erreur log -
!R1Ch@rD! - 24.10.2014
of this
pawn Код:
for(new i; i <= MAX_PLAYERS; i++)
put it in
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
Re: Erreur log -
sensi - 24.10.2014
Ok thx i testing that !
Respuesta: Re: Erreur log -
!R1Ch@rD! - 24.10.2014
Quote:
Originally Posted by sensi
Ok thx i testing that !
|
did that work?