SA-MP Forums Archive
Index 65535 - 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: Index 65535 (/showthread.php?tid=571264)



Index 65535 - zaibaslr2 - 17.04.2015

Hello,
This problem is really bothering me. It was all alright, when suddenly weird things started happening. I have crashdetect plugin, and sometimes (randomly, different callbacks, mostly OnPlayerConnect and OnPlayerSpawn) my client crashes or I get messages in console like these:
Код:
[16:13:23] [debug] Run time error 4: "Array index out of bounds"
[16:13:23] [debug]  Accessing element at index 65535 past array upper bound 499
[16:13:23] [debug] AMX backtrace:
[16:13:23] [debug] #0 0001fedc in ?? (0x00000002, 0x0000ffff, 0x3e799956, 0x3fc469d7) from Island.amx
[16:13:23] [debug] #1 000a1e30 in ?? (0x00000002) from Island.amx
[16:13:23] [debug] #2 0003a250 in ?? (0x00000002) from Island.amx
[16:13:23] [debug] #3 000c9df0 in public YSF_OnPlayerConnect (0x00000002) from Island.amx
[16:13:23] [debug] #4 0001edf0 in ?? (0x00000002) from Island.amx
[16:13:23] [debug] #5 000194f4 in public Streamer_OnPlayerConnect (0x00000002) from Island.amx
[16:13:23] [debug] #6 00015434 in public Itter_OnPlayerConnect (0x00000002) from Island.amx
[16:13:23] [debug] #7 00014214 in public SSCANF_OnPlayerConnect (0x00000002) from Island.amx
[16:13:23] [debug] #8 0000d950 in public MP_OPC (0x00000002) from Island.amx
[16:13:23] [debug] #9 native CallLocalFunction () [00472ef0] from samp-server.exe
[16:13:23] [debug] #10 0000b80c in public FIXES_OnPlayerConnect (0x00000002) from Island.amx
[16:13:23] [debug] #11 000039b4 in public OnPlayerConnect (0x00000002) from Island.amx
I know index 65535 stands for invalid, but I don't know what might cause this, it couldn't be INVALID_VEHICLE_ID, because I have absolutely no vehicles. I'm pretty sure it's INVALID_PLAYER_ID, but what might cause this to happen? Any help is appreciated.


Re: Index 65535 - Ahmad45123 - 17.04.2015

IDK really... But try having this in the start of your OnPlayerConnect to avoid the crash:
pawn Код:
if(playerid == INVALID_PLAYER_ID) return 1;
And also try compiling it with debug information by passing -d3 to the compiler to get the exact error line.


Re: Index 65535 - Konstantinos - 17.04.2015

Quote:
Originally Posted by zaibaslr2
Посмотреть сообщение
I know index 65535 stands for invalid, but I don't know what might cause this, it couldn't be INVALID_VEHICLE_ID, because I have absolutely no vehicles. I'm pretty sure it's INVALID_PLAYER_ID, but what might cause this to happen? Any help is appreciated.
As the last valid index is 499 (MAX_PLAYERS is defined by default 500), the problem is with players as you correct guessed.

Do as Ahmad45123 said, compile with -d3: https://github.com/Zeex/samp-plugin-...ith-debug-info
and update crashdetect plugin if you're using an older version and not 4.15.1: https://github.com/Zeex/samp-plugin-...es/tag/v4.15.1

After creating the pawn.cfg file into pawno\include folder and adding -d3 in it, save it and re-compile your scripts. If you get output with debug prefix to console/server log again, post them here.