What could cause these errors in CMD? - 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: What could cause these errors in CMD? (
/showthread.php?tid=662102)
What could cause these errors in CMD? -
NoteND - 23.12.2018
[debug] Run time error 4: "Array index out of bounds"
[debug] Attempted to read/write array element at index 1000 in array of size 1000
[debug] AMX backtrace:
[debug] #0 00006100 in ?? (178968, 1128792064) from MM.amx
[debug] #1 000071fc in main (0, 162864) from MM.amx
Re: What could cause these errors in CMD? -
v1k1nG - 24.12.2018
PHP код:
[debug] Run time error 4: "Array index out of bounds"
[debug] Attempted to read/write array element at index 1000 in array of size 1000
You created an array
PHP код:
new array[1000];
this array has 1000 cells.
array[1000] means that this symbol's cells go from 0 to 999.
Trying to write/read over that value will make you go "out of bounds"
Wrong writing
PHP код:
array[1000] = 5; // Out of bounds, max is 999
Wrong reading
PHP код:
printf("%d", array[1000]); // Out of bounds, max is 999