SA-MP Forums Archive
OnGameModeInit is runing multiple times - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: OnGameModeInit is runing multiple times (/showthread.php?tid=277911)



OnGameModeInit is runing multiple times - Steve M. - 19.08.2011

Hey guys. I'm using Linux CentOS 5.6 and when 4/5 players join my server, my OnGameModeInit runs multiple times. Any ides what might cause this?


Re: OnGameModeInit is runing multiple times - Ash. - 19.08.2011

Are you calling OnGameModeInit at any point?

For example:

pawn Код:
public OnPlayerConnect(playerid) { OnGameModeInit(); }



Re: OnGameModeInit is runing multiple times - Steve M. - 19.08.2011

No, I don't.


Re: OnGameModeInit is runing multiple times - Ash. - 20.08.2011

My dedicated server runs on CentOS and I don't have any problems with strange things being called. Could you show your OnGameModeInit code? (I have an idea but it's a really really long shot)


Re: OnGameModeInit is runing multiple times - Steve M. - 20.08.2011

Can you tell me your idea? Cause my OnGameModeInit callback is pretty long.


Re: OnGameModeInit is runing multiple times - Ash. - 20.08.2011

After further investigation of my "idea" - It turns out that wouldn't actually be an issue.

As a temporary fix though, do something like this:

pawn Код:
new bool:OGM=false;

public OnGameModeInit()
{
     if(OGM == true) return; //if it equals true, it has already been called and should not continue past this line
     OGM = true; //If the above if statement was false, this and the code below it will be executed - making "OGM" true, will cause the if statement above to become true, and thus, the OnGameModeInit callback will not be called again.
}



Re: OnGameModeInit is runing multiple times - Steve M. - 20.08.2011

I already did that. And I really can't figure out what's happening, dude.


Re: OnGameModeInit is runing multiple times - Ash. - 20.08.2011

Does it seem to be getting called at a regular interval? Every 10 seconds, for example. Or, is generally random?


Re: OnGameModeInit is runing multiple times - Steve M. - 20.08.2011

Nope. When 4/5 players enter the server, OnGameModeInit just gets called multiple times.


Re: OnGameModeInit is runing multiple times - Ash. - 20.08.2011

This may be a long shot, but try re-uploading samp03svr (The server executable file)

It could be slightly corrupt(?)