From b43d2ce038c01b75a12299b47f636500057809a7 Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 14 Jan 2024 20:19:51 +0200 Subject: [PATCH] add players count condition --- dlls/client.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/client.cpp b/dlls/client.cpp index 965236eb..4e5e0945 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -1024,12 +1024,14 @@ void StartFrame( void ) // END BOT // START BOT + int count = 0; + if( ( g_fGameOver ) && ( respawn_time < 1.0 ) ) { // if the game is over (time/frag limit) set the respawn time... respawn_time = 5.0; - // check if any players are using the botcam... + // cout total players for( i = 1; i <= gpGlobals->maxClients; i++ ) { CBasePlayer *pPlayer = (CBasePlayer *)UTIL_PlayerByIndex( i ); @@ -1037,13 +1039,15 @@ void StartFrame( void ) if( !pPlayer ) continue; // if invalid then continue with next index... - if( pPlayer->pBotCam ) + if( pPlayer->pBotCam ) // check if any players are using the botcam... pPlayer->pBotCam->Disconnect(); + + count++; // count the number of bots and players } } // check if a map was changed via "map" without kicking bots... - if( previous_time > gpGlobals->time ) + if( (count < max_bots) && (previous_time > gpGlobals->time) ) { bot_check_time = gpGlobals->time + 10.0;