Strange Debug Issue - 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: Strange Debug Issue (
/showthread.php?tid=610449)
Strange Debug Issue -
HydraHumza - 24.06.2016
Hello SA-MP Members
I hope all are good. I am having a strange issue
Код:
[12:29:09] [debug] Run time error 4: "Array index out of bounds"
[12:29:09] [debug] Accessing element at index 25 past array upper bound 24
[12:29:09] [debug] AMX backtrace:
[12:29:09] [debug] #0 000f9b18 in public OnPlayerStateChange (25, 2, 1) from Test.amx
public OnPlayerStateChange(playerid,newstate,oldstate)
What can be issue ?
Код:
undef MAX_PLAYERS
#define MAX_PLAYERS 100
the player is just for 24 players or what?
Re: Strange Debug Issue -
Konstantinos - 24.06.2016
https://github.com/Zeex/samp-plugin-...ith-debug-info
Do what the above post says, re-compile your scripts, run the server and if you get the debug logs again post them here. It will print the exact line.
It seems to me that an array has been declared with size of 25 instead of MAX_PLAYERS but get the logs and we'll see (you need at least a player with ID > 25 to reproduce it).
Re: Strange Debug Issue -
HydraHumza - 24.06.2016
Actually it happen after 25 so It will work in debian ? Cause That's issue only reproduce in my live server. So I can use there?
Re: Strange Debug Issue -
Stinged - 24.06.2016
Compile it with -d3 just like Konstantinos said, it will print more info in the console.
Re: Strange Debug Issue -
Konstantinos - 24.06.2016
You can make a copy of your script and run it through localhost with a broken code. Meaning in OnPlayerStateChange callback (at the top of it), set playerid to let's say 26 and let the rest of the code to be executed. You will get the logs directly without waiting for it to happen to a live server.