SA-MP Forums Archive
OnGameModeInit keeps getting called automatically. - 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: OnGameModeInit keeps getting called automatically. (/showthread.php?tid=571958)



OnGameModeInit keeps getting called automatically. - Ahmad45123 - 23.04.2015

Quote:

Sorry if I am creating too much helping threads recently :P

I had an issue where the server was freezing... I thought it was an infinite-iteration but when I compiled my script with debug level 7, I found that y_xml was storing stuff again and again, So I converted to SQL and I found that the SQL keeps getting saved again and again so I found that the whole OnGameModeInit keeps getting called again and again.
[I know there is alot of `again`, lol :P]

What can be the cause of this ? :/

I don't have it called manually anywhere.

Thanks in advanced.


Re: OnGameModeInit keeps getting called automatically. - Ahmad45123 - 23.04.2015

Ok, I made more debugging and actually not only my 'OnGameModeInit' but all hooked OnGameModeInits in all included files gets called again... :/

Very weird.


Re: OnGameModeInit keeps getting called automatically. - Ahmad45123 - 24.04.2015

Actually OnGameModeExit for some reason gets called automaticly just after OnGameModeInit gets called which causes the whole server to be restarted and OnGameModeInit called again.


Re: OnGameModeInit keeps getting called automatically. - Emmet_ - 24.04.2015

What includes do you have defined?


Re: OnGameModeInit keeps getting called automatically. - Ahmad45123 - 24.04.2015

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
What includes do you have defined?
PHP код:
#include <a_samp>
#include <YSI_Coding\y_timers>
#include <YSI_Coding\y_stringhash>
#include <YSI_Coding\y_va>
#include <YSI_Coding\y_hooks>
#include <YSI_Data\y_iterate>
#include <YSI_Storage\y_ini>
#include <streamer>
#include <a_zones>
#include <yom_buttons>
#include <progress>
#include <ZCMD>
#include <sscanf2>
#include <mSelection>
#include <easyDialog> 



Re: OnGameModeInit keeps getting called automatically. - Emmet_ - 24.04.2015

Seems like a weird issue to me. Did you try including the YSI libraries last? e.g.

pawn Код:
#include <a_samp>
#include <streamer>
#include <a_zones>
#include <yom_buttons>
#include <progress>
#include <ZCMD>
#include <sscanf2>
#include <mSelection>
#include <easyDialog>
#include <YSI_Coding\y_timers>
#include <YSI_Coding\y_stringhash>
#include <YSI_Coding\y_va>
#include <YSI_Coding\y_hooks>
#include <YSI_Data\y_iterate>
#include <YSI_Storage\y_ini>



Re: OnGameModeInit keeps getting called automatically. - Ahmad45123 - 24.04.2015

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
Seems like a weird issue to me. Did you try including the YSI libraries last? e.g.

pawn Код:
#include <a_samp>
#include <streamer>
#include <a_zones>
#include <yom_buttons>
#include <progress>
#include <ZCMD>
#include <sscanf2>
#include <mSelection>
#include <easyDialog>
#include <YSI_Coding\y_timers>
#include <YSI_Coding\y_stringhash>
#include <YSI_Coding\y_va>
#include <YSI_Coding\y_hooks>
#include <YSI_Data\y_iterate>
#include <YSI_Storage\y_ini>
Actually it is a weird issue.

I tried to move it but I got some random errors in streamer and when I moved it below YSI, it compiled, but still the same problem exists.

IDK if this may be useful or not but here is how the logs:
Код:
SA-MP Dedicated Server
----------------------
v0.3z-R3, ©2005-2014 SA-MP Team

[03:14:23] 
[03:14:23] Server Plugins
[03:14:23] --------------
[03:14:23]  Loading plugin: crashdetect
[03:14:23]   CrashDetect v4.15.1 is OK.
[03:14:23]   Loaded.
[03:14:23]  Loading plugin: streamer
[03:14:23] 

*** Streamer Plugin v2.7.4 by Incognito loaded ***

[03:14:23]   Loaded.
[03:14:23]  Loading plugin: sscanf
[03:14:23] 

[03:14:23]  ===============================

[03:14:23]       sscanf plugin loaded.     

[03:14:23]          Version:  2.8.1        

[03:14:23]    © 2012 Alex "******" Cole  

[03:14:23]  ===============================

[03:14:23]   Loaded.
[03:14:23]  Loading plugin: whirlpool
[03:14:23]  
[03:14:23]  ==================
[03:14:23]  
[03:14:23]   Whirlpool loaded
[03:14:23]  
[03:14:23]  ==================
[03:14:23]  
[03:14:23]   Loaded.
[03:14:23]  Loading plugin: fixes2
[03:14:23] 

[03:14:23]  ===============================

[03:14:23]        fixes plugin loaded.     

[03:14:23]    © 2012 Alex "******" Cole

[03:14:23]  ===============================

[03:14:23]   Loaded.
[03:14:23]  Loaded 5 plugins.

[03:14:23] I couldn't load any gamemode scripts. Please verify your server.cfg
[03:14:23] It needs a gamemode0 line at the very least.

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3z-R3, ©2005-2014 SA-MP Team

[03:16:43] 
[03:16:43] Server Plugins
[03:16:43] --------------
[03:16:43]  Loading plugin: crashdetect
[03:16:43]   CrashDetect v4.15.1 is OK.
[03:16:43]   Loaded.
[03:16:43]  Loading plugin: streamer
[03:16:43] 

*** Streamer Plugin v2.7.4 by Incognito loaded ***

[03:16:43]   Loaded.
[03:16:43]  Loading plugin: sscanf
[03:16:43] 

[03:16:43]  ===============================

[03:16:43]       sscanf plugin loaded.     

[03:16:43]          Version:  2.8.1        

[03:16:43]    © 2012 Alex "******" Cole  

[03:16:43]  ===============================

[03:16:43]   Loaded.
[03:16:43]  Loading plugin: whirlpool
[03:16:43]  
[03:16:43]  ==================
[03:16:43]  
[03:16:43]   Whirlpool loaded
[03:16:43]  
[03:16:43]  ==================
[03:16:43]  
[03:16:43]   Loaded.
[03:16:43]  Loading plugin: fixes2
[03:16:43] 

[03:16:43]  ===============================

[03:16:43]        fixes plugin loaded.     

[03:16:43]    © 2012 Alex "******" Cole

[03:16:43]  ===============================

[03:16:43]   Loaded.
[03:16:43]  Loaded 5 plugins.

[03:16:43] 
[03:16:43] Filterscripts
[03:16:43] ---------------
[03:16:43]   Loading filterscript 'buttons.amx'...
[03:16:43]   Loading filterscript 'brahem.amx'...
[03:16:43]   Loading filterscript 'IntDialog.amx'...
[03:16:43] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[03:16:43] 											  
[03:16:43] => Dialog System v1.1 By Garsino Loaded! <=
[03:16:43] 											  
[03:16:43] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[03:16:44]   Loaded 3 filterscripts.

[03:16:44]  
[03:16:44]  
[03:16:44]  
[03:16:44]  ======================================= 
[03:16:44]  |                                     | 
[03:16:44]  |        YSI version 4.00.0001        | 
[03:16:44]  |        By Alex "******" Cole        | 
[03:16:44]  |                                     | 
[03:16:44]  ======================================= 
[03:16:44]  
[03:16:44] Malloc_OnScriptInit called
[03:16:44] Malloc_TrySetup called
[03:16:44]  *** YSI Warning: y_malloc set up via "CallLocalFunction", memory corruption is a remote possibility
[03:16:44] Hooks_OnScriptInit called
[03:16:46] Hooks_OnScriptInit chain
[03:16:46] hook Timers_OnScriptInit called
[03:16:46] hook Timers_OnScriptInit ended
[03:16:46] Hooks_OnScriptInit end
[03:16:46] Iter_OnGameModeInit start: 500
[03:16:46] [DEBUG] OnGameModeInit Called, Time No# 0
[03:16:46] Turfs laoding.
[03:16:46] Paintball Arena 1 loaded
[03:16:46] Paintball Arena 2 loaded
[03:16:46] Paintball Arena 3 loaded
[03:16:46] Paintball Arena 4 loaded
[03:16:46] Paintball Arena 5 loaded
[03:16:46] Paintball Arena 6 loaded
[03:16:46] Paintball Arena 7 loaded
[03:16:46] Paintball Arena 8 loaded
[03:16:46] Paintball Arena 9 loaded
[03:16:46] Paintball Arena 10 loaded
[03:16:46] loading Event.
[03:16:46] Event loaded.
[03:16:46] Loading dealerships.
[03:16:46] Loading families.
[03:16:46] [script] 3DTEXTDRAW LIMIT: 1024 (Static, non-streamed) | 3DTEXTDRAW COUNT: 177
[03:16:46] [script] PICKUP LIMIT: 4096 (Static, non-streamed) | PICKUP COUNT: 55
[03:16:46] [script] OBJECT LIMIT: 1000 (Static, non-streamed) | OBJECT COUNT: 4090
[03:16:46] Iter_OnGameModeInit: first
[03:16:46] Malloc_main called
[03:16:46] Malloc_TrySetup called
[03:16:46]  
[03:16:46] -------------------------------------------
[03:16:46] Loading...
[03:16:46] Welcome to  Extra Gaming Roleplay
[03:16:46] -------------------------------------------
[03:16:46]  
[03:16:46] Number of vehicle models: 62
[03:16:46] Malloc_SolidifyTimer called
[03:16:46] Malloc_TrySetup called
[03:16:46] Malloc_SolidifyTimer called
[03:16:46] Malloc_TrySetup called
[03:16:46] Saving bizs.
[03:16:46] Business id 1 saved at script file biz.xml successfully.
[03:16:46] Business id 2 saved at script file biz.xml successfully.
[03:16:46] Business id 3 saved at script file biz.xml successfully.
[03:16:46] Business id 4 saved at script file biz.xml successfully.
[03:16:46] Business id 5 saved at script file biz.xml successfully.
[03:16:46] Business id 6 saved at script file biz.xml successfully.
[03:16:46] Business id 7 saved at script file biz.xml successfully.
[03:16:46] Business id 8 saved at script file biz.xml successfully.
[03:16:46] Business id 9 saved at script file biz.xml successfully.
[03:16:46] Business id 10 saved at script file biz.xml successfully.
[03:16:46] Business id 11 saved at script file biz.xml successfully.
[03:16:46] Business id 12 saved at script file biz.xml successfully.
[03:16:46] Business id 13 saved at script file biz.xml successfully.
[03:16:46] Business id 14 saved at script file biz.xml successfully.
[03:16:46] Business id 15 saved at script file biz.xml successfully.
[03:16:46] Business id 16 saved at script file biz.xml successfully.
[03:16:46] Business id 17 saved at script file biz.xml successfully.
[03:16:46] Saving houses.
[03:16:46] Saving Families HQ.
[03:16:46] Saving family HQ 0
[03:16:46] Saving family HQ 1
[03:16:46] Saving family HQ 2
[03:16:46] Saving family HQ 3
[03:16:46] Saving family HQ 4
[03:16:46] Saving family HQ 5
[03:16:46] Saving family HQ 6
[03:16:46] Saving family HQ 7
[03:16:46] Closing SQLite DB.
[03:17:09]  
[03:17:09]  
[03:17:09]  
[03:17:09]  ======================================= 
[03:17:09]  |                                     | 
[03:17:09]  |        YSI version 4.00.0001        | 
[03:17:09]  |        By Alex "******" Cole        | 
[03:17:09]  |                                     | 
[03:17:09]  ======================================= 
[03:17:09]  
[03:17:09] Malloc_OnScriptInit called
[03:17:09] Malloc_TrySetup called
[03:17:09]  *** YSI Warning: y_malloc set up via "CallLocalFunction", memory corruption is a remote possibility
[03:17:09] Hooks_OnScriptInit called
[03:17:11] Hooks_OnScriptInit chain
[03:17:11] hook Timers_OnScriptInit called
[03:17:11] hook Timers_OnScriptInit ended
[03:17:11] Hooks_OnScriptInit end
[03:17:11] Iter_OnGameModeInit start: 500
[03:17:11] [DEBUG] OnGameModeInit Called, Time No# 0
[03:17:11] Turfs laoding.
[03:17:11] Paintball Arena 1 loaded
[03:17:11] Paintball Arena 2 loaded
[03:17:11] Paintball Arena 3 loaded
[03:17:11] Paintball Arena 4 loaded
[03:17:11] Paintball Arena 5 loaded
[03:17:11] Paintball Arena 6 loaded
[03:17:11] Paintball Arena 7 loaded
[03:17:11] Paintball Arena 8 loaded
[03:17:11] Paintball Arena 9 loaded
[03:17:11] Paintball Arena 10 loaded
[03:17:11] loading Event.
[03:17:11] Event loaded.
[03:17:11] Loading dealerships.
[03:17:11] Loading families.
[03:17:11] [script] 3DTEXTDRAW LIMIT: 1024 (Static, non-streamed) | 3DTEXTDRAW COUNT: 177
[03:17:11] [script] PICKUP LIMIT: 4096 (Static, non-streamed) | PICKUP COUNT: 55
[03:17:11] [script] OBJECT LIMIT: 1000 (Static, non-streamed) | OBJECT COUNT: 4090
[03:17:11] Iter_OnGameModeInit: first
[03:17:11] Malloc_main called
[03:17:11] Malloc_TrySetup called
[03:17:11]  
[03:17:11] -------------------------------------------
[03:17:11] Loading...
[03:17:11] Welcome to  Extra Gaming Roleplay
[03:17:11] -------------------------------------------
[03:17:11]  
[03:17:11] Number of vehicle models: 62
[03:17:11] Malloc_SolidifyTimer called
[03:17:11] Malloc_TrySetup called
[03:17:11] Malloc_SolidifyTimer called
[03:17:11] Malloc_TrySetup called
[03:17:11] Saving bizs.
[03:17:11] Business id 1 saved at script file biz.xml successfully.
[03:17:11] Business id 2 saved at script file biz.xml successfully.
[03:17:11] Business id 3 saved at script file biz.xml successfully.
[03:17:11] Business id 4 saved at script file biz.xml successfully.
[03:17:11] Business id 5 saved at script file biz.xml successfully.
[03:17:11] Business id 6 saved at script file biz.xml successfully.
[03:17:11] Business id 7 saved at script file biz.xml successfully.
[03:17:11] Business id 8 saved at script file biz.xml successfully.
[03:17:11] Business id 9 saved at script file biz.xml successfully.
[03:17:11] Business id 10 saved at script file biz.xml successfully.
[03:17:11] Business id 11 saved at script file biz.xml successfully.
[03:17:11] Business id 12 saved at script file biz.xml successfully.
[03:17:11] Business id 13 saved at script file biz.xml successfully.
[03:17:11] Business id 14 saved at script file biz.xml successfully.
[03:17:11] Business id 15 saved at script file biz.xml successfully.
[03:17:11] Business id 16 saved at script file biz.xml successfully.
[03:17:11] Business id 17 saved at script file biz.xml successfully.
[03:17:11] Saving houses.
[03:17:11] Saving Families HQ.
[03:17:11] Saving family HQ 0
[03:17:11] Saving family HQ 1
[03:17:11] Saving family HQ 2
[03:17:11] Saving family HQ 3
[03:17:11] Saving family HQ 4
[03:17:11] Saving family HQ 5
[03:17:11] Saving family HQ 6
[03:17:11] Saving family HQ 7
[03:17:11] Closing SQLite DB.
[03:17:11]  
[03:17:11]  
[03:17:11]  
[03:17:11]  ======================================= 
[03:17:11]  |                                     | 
[03:17:11]  |        YSI version 4.00.0001        | 
[03:17:11]  |        By Alex "******" Cole        | 
[03:17:11]  |                                     | 
[03:17:11]  ======================================= 
[03:17:11]  
[03:17:11] Malloc_OnScriptInit called
[03:17:12] Malloc_TrySetup called
[03:17:12]  *** YSI Warning: y_malloc set up via "CallLocalFunction", memory corruption is a remote possibility
[03:17:12] Hooks_OnScriptInit called
[03:17:14] Hooks_OnScriptInit chain
[03:17:14] hook Timers_OnScriptInit called
[03:17:14] hook Timers_OnScriptInit ended
[03:17:14] Hooks_OnScriptInit end
[03:17:14] Iter_OnGameModeInit start: 500
[03:17:14] [DEBUG] OnGameModeInit Called, Time No# 0
[03:17:14] Turfs laoding.
[03:17:14] Paintball Arena 1 loaded
[03:17:14] Paintball Arena 2 loaded
[03:17:14] Paintball Arena 3 loaded
[03:17:14] Paintball Arena 4 loaded
[03:17:14] Paintball Arena 5 loaded
[03:17:14] Paintball Arena 6 loaded
[03:17:14] Paintball Arena 7 loaded
[03:17:14] Paintball Arena 8 loaded
[03:17:14] Paintball Arena 9 loaded
[03:17:14] Paintball Arena 10 loaded
[03:17:14] loading Event.
[03:17:14] Event loaded.
[03:17:14] Loading dealerships.
[03:17:14] Loading families.
[03:17:14] [script] 3DTEXTDRAW LIMIT: 1024 (Static, non-streamed) | 3DTEXTDRAW COUNT: 177
[03:17:14] [script] PICKUP LIMIT: 4096 (Static, non-streamed) | PICKUP COUNT: 55
[03:17:14] [script] OBJECT LIMIT: 1000 (Static, non-streamed) | OBJECT COUNT: 4090
[03:17:14] Iter_OnGameModeInit: first
[03:17:14] Malloc_main called
[03:17:14] Malloc_TrySetup called
[03:17:14]  
[03:17:14] -------------------------------------------
[03:17:14] Loading...
[03:17:14] Welcome to  Extra Gaming Roleplay
[03:17:14] -------------------------------------------
[03:17:14]  
[03:17:14] Number of vehicle models: 62
[03:17:14] Malloc_SolidifyTimer called
[03:17:14] Malloc_TrySetup called
[03:17:14] Malloc_SolidifyTimer called
[03:17:14] Malloc_TrySetup called
[03:17:14] Saving bizs.
[03:17:14] Business id 1 saved at script file biz.xml successfully.
[03:17:14] Business id 2 saved at script file biz.xml successfully.
[03:17:14] Business id 3 saved at script file biz.xml successfully.
[03:17:14] Business id 4 saved at script file biz.xml successfully.
[03:17:14] Business id 5 saved at script file biz.xml successfully.
[03:17:14] Business id 6 saved at script file biz.xml successfully.
[03:17:14] Business id 7 saved at script file biz.xml successfully.
[03:17:14] Business id 8 saved at script file biz.xml successfully.
[03:17:14] Business id 9 saved at script file biz.xml successfully.
[03:17:14] Business id 10 saved at script file biz.xml successfully.
[03:17:14] Business id 11 saved at script file biz.xml successfully.
[03:17:14] Business id 12 saved at script file biz.xml successfully.
[03:17:14] Business id 13 saved at script file biz.xml successfully.
[03:17:14] Business id 14 saved at script file biz.xml successfully.
[03:17:14] Business id 15 saved at script file biz.xml successfully.
[03:17:14] Business id 16 saved at script file biz.xml successfully.
[03:17:14] Business id 17 saved at script file biz.xml successfully.
[03:17:14] Saving houses.
[03:17:14] Saving Families HQ.
[03:17:14] Saving family HQ 0
[03:17:14] Saving family HQ 1
[03:17:14] Saving family HQ 2
[03:17:14] Saving family HQ 3
[03:17:14] Saving family HQ 4
[03:17:14] Saving family HQ 5
[03:17:14] Saving family HQ 6
[03:17:14] Saving family HQ 7
[03:17:14] Closing SQLite DB.
And keeps going like that again and again...


Re: OnGameModeInit keeps getting called automatically. - Emmet_ - 24.04.2015

It seems to me that something in the script is explicitly restarting the server, either by:

pawn Код:
SendRconCommand("gmx");
Or:

pawn Код:
GameModeExit();
Search for those two functions and remove them.


Re: OnGameModeInit keeps getting called automatically. - Ahmad45123 - 24.04.2015

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
It seems to me that something in the script is explicitly restarting the server, either by:

pawn Код:
SendRconCommand("gmx");
Or:

pawn Код:
GameModeExit();
Search for those two functions and remove them.
Oooo... I totally forgot about that function, I kept searching for stuff like CallLocalFunction("OnGameModeExit")

And yes, Its fixed after probably 10 hours of continues hard-working..
Thanks alot mate

What I did is that I had a anti-theft system in my script which was created from a very very long time that I even forgot about it which made my script get closed automaticly...

Actually, I till now can't believe the fix is that simple, You don't know what I did to attempt to fix this :P
I rewrote all of the server stuff to mysql.
I was very lazy to convert it, But because of the bug, I got motivated to rewrite it, lol :P