From 1f79db212536f24f697c934d3e50f1870705e2a7 Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 11 Jun 2020 21:14:41 +0200 Subject: [PATCH] Fix nJoinAllowed returning a negative amount of available player slots if g_maxplayers is negative --- qcsrc/server/client.qc | 4 ++-- qcsrc/server/defs.qh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index a0f5c8a38f..fe2952711f 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2018,10 +2018,10 @@ int nJoinAllowed(entity this, entity ignore) int player_limit = GetPlayerLimit(); - float free_slots = 0; + int free_slots = 0; if (!player_limit) free_slots = maxclients - totalClients; - else if(currentlyPlaying < player_limit) + else if(player_limit > 0 && currentlyPlaying < player_limit) free_slots = min(maxclients - totalClients, player_limit - currentlyPlaying); static float msg_time = 0; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index a8ec77959a..e12970a9c6 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -146,7 +146,7 @@ void checkSpectatorBlock(entity this); .float alivetime; // time of being alive .float motd_actived_time; // used for both motd and campaign_message -bool nJoinAllowed(entity this, entity ignore); +int nJoinAllowed(entity this, entity ignore); .float spawnshieldtime; .float item_spawnshieldtime; -- 2.39.2