SA-MP Forums Archive
Server bugs completely @ high player count - 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: Server bugs completely @ high player count (/showthread.php?tid=308147)



Server bugs completely @ high player count - Sinner - 02.01.2012

When my server reaches a "high" (relative) player count (40 or higher) it starts bugging. With bugging I mean that nothing seems to be working the way it should anymore, not even the samp callbacks:

(1) Most admin commands don't work anymore (ban, kick, mute, slap, ... - maybe sscanf?)
(2) Players can connect without actually registering, so they can just skip the register dialog whilest this is script-wise impossible
(3) The OnPlayerText callback always returns 1, even when I force it to return 0, this causes all the otherwise private chats to be visible (admin chat, channel chat, ...)
(4) Players getting stuck when they connect, ...

The list goes on and on and frankly I'm baffled. The server uses A LOT of enums, I can't see how this is a problem though. Has anyone else had this problem before?

I'm not a newcomer when it comes to writing pawn code, all my plugins and includes are up-to date and in most cases I know pretty damn well what I'm doing so please don't make any stupid suggestions.

100++ rep for the person who solves the problem


Re: Server bugs completely @ high player count - Basssiiie - 02.01.2012

Maybe you have defined MAX_PLAYERS as a number below the 40? I've noticed sometimes that a script itself can crash. The entire filterscript stops working without any warning. Maybe there is such bug in one of your gamemode/filterscripts. I guess such bug is in the same script as the admin commands and the registration system.


Re: Server bugs completely @ high player count - silvan - 02.01.2012

check your MAX_PLAYERS and also couple of for loops if you use them.


Re: Server bugs completely @ high player count - Babul - 02.01.2012

presuming your server uns on linux, i suggest you to have an eye on the Load Average plugin, then write a simple filterscript which outputs a secondly CPU-load string.
if you want a quick "debug", let the script spam GameTextForAll each second, telling the CPU load.

another help could be the Performance profiler plugin, in case its not the CPU.. it cant be wrong to know which callback uses the most resources, but its not the best idea to use it on a public server, just run it with a few players at your local testserver, to check how the script behaves..

btw, my first idea was a looping problem. you got some commands like /rape /rob /whisper /wave /heal, which are looping through all players, checking for some distance (using sqroot for exact distance calculations maybe)?
silvan pointed me to the MAX_PLAYERS problem. instead of using 500 (standard), you can create a new variable like
pawn Код:
new MaxPlayers;
then in OnGamemodeInit()
pawn Код:
MaxPlayers=GetMaxPlayers();
...then use the MaxPlayers (40) instead of MAX_PLAYERS (500 or 800). if more scripts need to know the MaxPlayers, you also can use a global variable maybe? that would justify using MaxPlayers as GVar instead of redefining it


Re: Server bugs completely @ high player count - Basssiiie - 02.01.2012

Or use this:
Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 40
Replace 40 with the amount the server can handle. Make sure to place it just after #include <a_samp>.


Re: Server bugs completely @ high player count - Sinner - 02.01.2012

Thanks everyone problem has been solved Due to a merge-error in our server's repository the MAX_PLAYERS got reset to our old max players count bugging everyone over 50 players.

Rep all the people!!!