SA-MP Forums Archive
Disallow connections until server is loaded - 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: Disallow connections until server is loaded (/showthread.php?tid=640262)



Disallow connections until server is loaded - Misiur - 30.08.2017

As in title. Basically, there's a massive amount of things that are happening in my OnGamemodeInit (y_malloc allocations, y_text loading and a lot of queries (threaded though)). Can I somehow disallow any connections until I trigger it somehow from my gamemode? I know there exists something like iptables, maybe it would be possible to write connection dropping rules in them via some plugin and then restore previous settings?


Re: Disallow connections until server is loaded - IstuntmanI - 30.08.2017

Well, I thought about the same problem few months ago. The solution to properly load the gamemode without letting players in was to kick players and tell them to reconnect in the reason (pretty dumb), the reason for that was that I was loading everything (houses, races and more) threaded too. I wanted to fix this kicking issue, as players got kicked a lot when the server just restarted. The solution I came with was to use mysql_query instead of mysql_t/pquery. This is a lot better, you don't need to use threaded queries under OnGameModeInit. Just remember to delete the result from mysql_query. Connections will just wait until OnGameModeInit finishes. I find this to be the best method. The only problem is that, AFAIK, SA-MP kicks players by itself when they are trying to connect with no success - like when the server hangs TOO MUCH in some code [usually infinite loops]) There's no other need to limit connections than those threaded queries, YSI inits everything fine at OnGameModeInit, without any need to wait a bit until after the startup.

EDIT: This may help you to change your mysql_tquery lines to mysql_query: https://github.com/pBlueG/SA-MP-MySQL/issues/76 .


Re: Disallow connections until server is loaded - iLearner - 30.08.2017

My DayZ server had similar need, what the creator had done was locking the server on init and call the function startserver() when loading was done to remove password.


Re: Disallow connections until server is loaded - Misiur - 30.08.2017

The password looks simple and promising, I'll definitely give it a try