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=646564)



Run time error 4: "Array index out of bounds" - MarllonGTA - 19.12.2017

Olб amigos, estou criando um sistema de Fallout simples, o compilador atй passa, mas ingame estб crashando o servidor. Passei o Crashdetect e deu isso.
Code:
[01:05:28] [debug] Run time error 4: "Array index out of bounds"
[01:05:28] [debug]  Attempted to read/write array element at index 50 in array of size 50
[01:05:28] [debug] AMX backtrace:
[01:05:28] [debug] #0 002c4958 in public IniciandoFallout () at C:\Users\User\Desktop\gamemodes\DME.pwn:45320
PHP Code:
function IniciandoFallout()
{
    
SetTimer("TimerFallout"10000);
    for(new 
0<= MAX_PLAYERSi++)
    {
        if(
Player[i][EmEvento] == 1//Linha do Erro
        
{
            new 
Random random(sizeof(SpawnFallout));
            
SetPlayerPos(iSpawnFallout[Random][0], SpawnFallout[Random][1], SpawnFallout[Random][2]);
            
SendClientMessage(iCOR_CV"Evento Iniciado! Boa Sorte!");
            
TogglePlayerControllable(i1);
        }
    }

Poderiam me ajudar?


Re: Run time error 4: "Array index out of bounds" - rjjj - 19.12.2017

Mude o cabeзalho do loop para :



Code:
for(new i = 0; i < MAX_PLAYERS; i++)


Espero ter ajudado .


Re: Run time error 4: "Array index out of bounds" - MarllonGTA - 19.12.2017

Quote:
Originally Posted by rjjj
View Post
Mude o cabeзalho do loop para :



Code:
for(new i = 0; i < MAX_PLAYERS; i++)


Espero ter ajudado .
Puts, era sу isso mesmo! Que falta de atenзгo kkkkkk
valeu mano! Valeu Mesmo