SA-MP Forums Archive
Array index out of bounds - 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: Array index out of bounds (/showthread.php?tid=620822)



Array index out of bounds - KessMan - 03.11.2016

Error with "y_iterate".
ERROR:
HTML Code:
[08:22:46] [debug] Run time error 4: "Array index out of bounds"
[08:22:46] [debug]  Attempted to read/write array element at index 302 in array of size 302
Line ERROR:
HTML Code:
foreach(new c : Rellout) SetCameraBehindPlayer©, SetPlayerVirtualWorld(c, 0), SendClientMessage(c, -1, "End round."), Iter_Remove(Rellout, c);
Other:
HTML Code:
new Iterator:Rellout<MAX_PLAYERS>;



Re: Array index out of bounds - Konstantinos - 03.11.2016

I really doubt it's an issue with y_iterate. You need to post a detailed log of crashdetect and not just two lines if you want to help us find the problem. Compiling with debug info is very useful to get the exact line: https://github.com/Zeex/samp-plugin-...ith-debug-info


Re: Array index out of bounds - KessMan - 03.11.2016

This is the exact line I compiled with "-d3"
HTML Code:
foreach(new c : Rellout) SetCameraBehindPlayer©, SetPlayerVirtualWorld(c, 0), SendClientMessage(c, -1, "End round."), Iter_Remove(Rellout, c);



Re: Array index out of bounds - KessMan - 03.11.2016

Anyone? ...


Re: Array index out of bounds - Konstantinos - 03.11.2016

As I told you earlier, these two lines of crashdetect are only a part of it. Without the full output of the plugin, nobody can help you - we cannot just guess what is the problem (is it related to the loop itself, Iter_Remove etc.)

For now, all I can tell you is update to YSI 4 which this issue definitely not exists and if it persists to happen then the problem is with your code. Re-defining MAX_PLAYERS after including y_iterate might be a reason as well.