SA-MP Forums Archive
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: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Run time error 4: "Array index out of bounds" (/showthread.php?tid=633707)



Run time error 4: "Array index out of bounds" - Blackaslan - 06.05.2017

Hi , necesito ayuda porfavor:

Mi servidor no comienza debido a esto:

Quote:

[06:42:45] [debug] Run time error 4: "Array index out of bounds"
[06:42:45] [debug] Accessing element at index 5 past array upper bound 4
[06:42:45] [debug] AMX backtrace:
[06:42:45] [debug] #0 00043b0c in main () at C:\Users\x\Desktop\x\x\Linux\x\x.pwn:615
[06:42:45] Script[gamemodes/x.amx]: Run time error 4: "Array index out of bounds"
[06:42:45] Number of vehicle models: 0

Line 615 of my script :

Код:
	for(new i = 0; i<MAX_PLAYERS; i++) 
	{
		labelStats[i] = Create3DTextLabel(" ", -1, 0.0, 0.0, 4000.0, 50.0, 0, 1);
	}
Cualquier ayuda se agradece!


Respuesta: Run time error 4: "Array index out of bounds" - Parka - 06.05.2017

El arreglo labelStats estб obteniendo un valor de la variable i que es mayor a el tamaсo dado, es decir, el tamaсo del arreglo es 4 y esta accediendo al 5 el cual no existe.


Re: Run time error 4: "Array index out of bounds" - OtimoJogo - 06.05.2017

Ha configurado una variable global de esa manera:
pawn Код:
new Text3D:labelStats[MAX_PLAYERS];
?


Re: Run time error 4: "Array index out of bounds" - Blackaslan - 06.05.2017

Quote:
Originally Posted by OtimoJogo
Посмотреть сообщение
Ha configurado una variable global de esa manera:
pawn Код:
new Text3D:labelStats[MAX_PLAYERS];
?
new Text3D:labelStats[MAX_PLAYERS];

Gracias , solucionado