X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fclient.qc;h=e8ca9649fde09b89d84f0175d582c653560d6988;hp=da0d84979f5e139531a89f86f410184b51ea7759;hb=8e5d376c49510049572c7c182ba8778c8a8f80dd;hpb=bb6e4e97897e547031eb711018bf4d46e3ec280b diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index da0d84979f..e8ca9649fd 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1911,6 +1911,14 @@ void Join(entity this) this.team_selected = false; } +int GetPlayerLimit() +{ + int player_limit = autocvar_g_maxplayers; + MUTATOR_CALLHOOK(GetPlayerLimit, player_limit); + player_limit = M_ARGV(0, int); + return player_limit; +} + /** * Determines whether the player is allowed to join. This depends on cvar * g_maxplayers, if it isn't used this function always return true, otherwise @@ -1943,11 +1951,13 @@ int nJoinAllowed(entity this, entity ignore) ++currentlyPlaying; }); + int player_limit = GetPlayerLimit(); + float free_slots = 0; - if (!autocvar_g_maxplayers) + if (!player_limit) free_slots = maxclients - totalClients; - else if(currentlyPlaying < autocvar_g_maxplayers) - free_slots = min(maxclients - totalClients, autocvar_g_maxplayers - currentlyPlaying); + else if(currentlyPlaying < player_limit) + free_slots = min(maxclients - totalClients, player_limit - currentlyPlaying); static float join_prevent_msg_time = 0; if(this && ignore && !free_slots && time > join_prevent_msg_time)