20.01.2013, 05:25
While testing a script I noticed something unusual - a message that was shown when my script started was being shown twice, yet it shouldn't have been called a second time.
I investigated a little further and found that OnFilterScriptInit was being called twice. Going even further again, I found that it was being called when the script was unloaded, then again - properly - when the script was loaded.
I stripped out everything that was actually being called in both my OnFilterScriptInit and OnFilterScriptExit methods, and used two print messages to check when those callbacks were being called - they're both called when the script is unloading, before OnFilterScriptInit is called again when it actually should be.
I'm using fixes2, a_mysql (BlueG's), sscanf2, zcmd, foreach and y_hooks - I assume the problem is coming from one of these hooking and calling OnFilterScriptInit when it shouldn't, but I have no idea where to start looking here.
The following is from my server log once the script has been loaded (it's set to load on start) and I call 'reloadfs script' in-game via rcon:
Note "OnPlayerConnect(5)" above - there is no playerid 5, there should never be that playerid. I'm the only person on the server, there are no NPCs so it should only ever be 0 - me!
I also have no idea where I'm trying to "access an array at index 1411900269".... this is just really fucking weird.
I investigated a little further and found that OnFilterScriptInit was being called twice. Going even further again, I found that it was being called when the script was unloaded, then again - properly - when the script was loaded.
I stripped out everything that was actually being called in both my OnFilterScriptInit and OnFilterScriptExit methods, and used two print messages to check when those callbacks were being called - they're both called when the script is unloading, before OnFilterScriptInit is called again when it actually should be.
I'm using fixes2, a_mysql (BlueG's), sscanf2, zcmd, foreach and y_hooks - I assume the problem is coming from one of these hooking and calling OnFilterScriptInit when it shouldn't, but I have no idea where to start looking here.
The following is from my server log once the script has been loaded (it's set to load on start) and I call 'reloadfs script' in-game via rcon:
Код:
[17:38:44] RCON (In-Game): Player [ev0lution] sent command: reloadfs script [17:38:44] > OnFilterScriptInit START [17:38:44] > OnFilterScriptInit FINISH [17:38:44] > OnFilterScriptExit START [17:38:44] > OnFilterScriptExit FINISH [17:38:44] OnPlayerConnect(5) [17:38:44] [debug] Run time error 4: "Array index out of bounds" [17:38:44] [debug] Accessing element at index 1411900269 past array upper bound 9 [17:38:44] [debug] AMX backtrace: [17:38:44] [debug] #0 00020f80 in public S@@_OnPlayerSpawn (playerid=6) at script.pwn:621 [17:38:44] [debug] #1 00014910 in public AMX_OnScriptInit () at C:\Users\ev0lution\Desktop\samp03svr\pawno\include\YSI\internal\y_dohooks.inc:437 [17:38:44] [debug] #2 00007678 in public AMX_OnScriptInit () at C:\Users\ev0lution\Desktop\samp03svr\pawno\include\YSI\internal\..\y_scriptinit.inc:217 [17:38:44] Filterscript 'script.amx' unloaded. [17:38:44] [17:38:44] [17:38:44] [17:38:44] ======================================= [17:38:44] | | [17:38:44] | YSI version 1.06.0002 | [17:38:44] | By Alex "******" Cole | [17:38:44] | | [17:38:44] ======================================= [17:38:44] [17:38:44] [17:38:44] [17:38:44] Iter_OnFilterScriptInit start: 500 [17:38:44] > OnFilterScriptInit START [17:38:44] > OnFilterScriptInit FINISH [17:38:44] Iter_OnFilterScriptInit end [17:38:44] Filterscript 'script.amx' loaded.
I also have no idea where I'm trying to "access an array at index 1411900269".... this is just really fucking weird.