[Ajuda] "Array Index of bounds"
#1

Dб-me este erro no seguinte cуdigo:
Code:
if(InArena[playerid] == true){
        format(string, sizeof string, "%d", aKills[playerid]);
        TextDrawSetString(ArenaTD[playerid][3], string);
        format(string, sizeof string, "%d", aDeaths[playerid]);
        TextDrawSetString(ArenaTD[playerid][7], string);
        if(aDeaths[playerid] == 0) format(string,sizeof(string),"%d.00", aKills[playerid]);
        else if(aKills[playerid] != aDeaths[playerid])format(string,sizeof(string),"%.2f",float(aKills[playerid])/float(aDeaths[playerid]));
		else if(aKills[playerid] == aDeaths[playerid])format(string,sizeof(string),"%d", 1);
        TextDrawSetString(ArenaTD[playerid][10], string);
        format(string, sizeof string, "%d:%d", TempoArena/60, TempoArena%60);
        TextDrawSetString(ArenaTD[playerid][13], string);
        format(string, sizeof string, "[%s]", NomesArena[ArenaID]);
        TextDrawSetString(ArenaTD[playerid][14], string);
        TextDrawShowForPlayer(playerid, ArenaTD[playerid][0]);
    }
Reply
#2

Qual linha, qual variбvel, ninguйm manja das bola de cristal aqui nгo...
Reply
#3

Vocк criou uma array e estб ultrapassando o limite dela.

ex:
pawn Code:
new array[10];

public OnGameModeInit()
{
    array[12] = 3; // 12 estб acima do limite criado na array!
    return 1;
}
Reply
#4

Sim eu sei, mas acho que nгo esta a ultrupassar ennhuma, veja:

pawn Code:
new NomesArena[] = {"EL QUEBRADOS"};
new bool:InArena[MAX_PLAYERS];
new aKills[MAX_PLAYERS];
new aDeaths[MAX_PLAYERS];
new PlayerText:ArenaTD[MAX_PLAYERS][15];


//\/\/\/\/ \/\/ ERRO AQUI \/\/\/\/\/\/ \/\/
if(InArena[playerid] == true){
        format(string, sizeof string, "%d", aKills[playerid]);
        PlayerTextDrawSetString(playerid,ArenaTD[playerid][3], string);
        format(string, sizeof string, "%d", aDeaths[playerid]);
        PlayerTextDrawSetString(playerid,ArenaTD[playerid][7], string);
        if(aDeaths[playerid] == 0) format(string,sizeof(string),"%d.00", aKills[playerid]);
        else if(aKills[playerid] != aDeaths[playerid])format(string,sizeof(string),"%.2f",float(aKills[playerid])/float(aDeaths[playerid]));
        else if(aKills[playerid] == aDeaths[playerid])format(string,sizeof(string),"%d", 1);
        PlayerTextDrawSetString(playerid,ArenaTD[playerid][10], string);
        format(string, sizeof string, "%d:%d", TempoArena/60, TempoArena%60);
        PlayerTextDrawSetString(playerid,ArenaTD[playerid][13], string);
        format(string, sizeof string, "[%s]", NomesArena[ArenaID]);
        PlayerTextDrawSetString(playerid,ArenaTD[playerid][14], string);
    }
Code:
[debug] Run time error 4: "Array index out of bounds"
[debug] AMX backtrace:
[debug] #0 00067dc0 in public TimerPessoal (0x00000005)
Tenho a certeza, que o erro esta onde eu indiquei, pois foi quando adicionei isso que comeзou a dar o erro e estб a dar no local onde eu adicionei.....
Reply
#5

Vai tirando linha por linha e ve se o erro some quando vocк tira alguma, assim vocк tem como especificar melhor o local do erro...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)