SA-MP Forums Archive
[Ajuda] Run time error 4: "Array index out of bounds" - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Run time error 4: "Array index out of bounds" (/showthread.php?tid=528226)



Run time error 4: "Array index out of bounds" - VeNuZ_ - 26.07.2014

Код:
[00:18:03] [debug] Run time error 4: "Array index out of bounds"
[00:18:03] [debug]  Accessing element at index 39565151 past array upper bound 69
[00:18:03] [debug] AMX backtrace:
[00:18:03] [debug] #0 000644b0 in ?? () from TrNewGM.amx
[00:18:03] [debug] #1 0002c584 in public cmd_pato () from TrNewGM.amx
[00:18:03] [debug] #2 native CallLocalFunction () [00472ad0] from samp-server.exe
[00:18:03] [debug] #3 00002258 in public OnPlayerCommandText () from TrNewGM.amx
Ajuda ?


Re: Run time error 4: "Array index out of bounds" - LKING - 26.07.2014

Код:
new array[ MAX_PLAYERS ];

array[ 39565151 ] = something;//indexed oob



Re: Run time error 4: "Array index out of bounds" - zSuYaNw - 27.07.2014

Verifique seu cуdigo, vocк estб tentando acessar valores que nгo foram criados, exemplo:

pawn Код:
new my_variable[10];


my_variable[21] = 'a';



Re: Run time error 4: "Array index out of bounds" - VeNuZ_ - 27.07.2014

pawn Код:
stock RandomPlayerPato()
{
    new OnlineUser[MAX_PLAYERS], ContaPlayers = 0;
    for(new i = 0; i <= MAX_PLAYERS; i++)
        if(IsPlayerConnected(i))
            if(Afk[i] == false)
                if(PlayerLogado[i] == true)
                    if(GetPlayerState(i) != PLAYER_STATE_SPECTATING)
                        if(GetPlayerVirtualWorld(i) == 0)
                            if(!PlayerEsc(i))
                                if(!IsInTrampolim(i))
                                    if(!IsARCvehicle(GetPlayerVehicleID(i)))
                                        if(PlayerInfo[i][tempopreso] == 0)
                                            if(IsPlayerInArea(i,PatoArea))
                                                if(!IsPlayerNPC(i))
                                                    OnlineUser[ContaPlayers] = i, ContaPlayers++;
    return OnlineUser[random(ContaPlayers)];
}
Mas continua a dar esse erro...


Re: Run time error 4: "Array index out of bounds" - VeNuZ_ - 29.07.2014

Alguem ?