Incredibly weird behaviour when reloading filterscripts
#1

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:
Код:
[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.
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.
Reply
#2

pawn Код:
[17:38:44] [debug] #0 00020f80 in public S@@_OnPlayerSpawn (playerid=6) at script.pwn:621
Reply
#3

Quote:
Originally Posted by Glad2BeHere
Посмотреть сообщение
pawn Код:
[17:38:44] [debug] #0 00020f80 in public S@@_OnPlayerSpawn (playerid=6) at script.pwn:621
That is not the main problem, and it's not even relevant to the crash.

The problem is OnFilterScriptInit being called when the script unloads.

That crash probably happens because there is no playerid=6, so the fact that OnPlayerSpawn is called with that is another problem.
Reply
#4

I'm interested into what this is: AMX_OnScriptInit
Reply
#5

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
I'm interested into what this is: AMX_OnScriptInit
^^

No such guides on the Wiki, maybe there in YSI.. ( I think AMX_OnScriptInit is a part of YSI )
Reply
#6

Seems like it: y_scriptinit.inc, y_dohooks.inc

Just have a quick browse through them for anything you think may be affecting it. If there is, I wouldn't recommend editing it just to fix the problem, as it might create more. At least you will know what is causing the problem though if it turns out it is.
Reply
#7

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
Seems like it: y_scriptinit.inc, y_dohooks.inc

Just have a quick browse through them for anything you think may be affecting it. If there is, I wouldn't recommend editing it just to fix the problem, as it might create more. At least you will know what is causing the problem though if it turns out it is.
Okay enough to not use y_scriptinit and y_dohooks?
Reply
#8

Yeah those are internally used by y_hooks, which is what was being used.

That was indeed the problem, too... my solution was simply to edit the include to avoid using y_hooks, but the fact that that include has such a massive bug/flaw is definitely something that needs to be looked into. Time to complain to ****** I suppose!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)