Browse Source

add players count condition

bot10-yggverse
ghost 11 months ago
parent
commit
b43d2ce038
  1. 10
      dlls/client.cpp

10
dlls/client.cpp

@ -1024,12 +1024,14 @@ void StartFrame( void )
// END BOT // END BOT
// START BOT // START BOT
int count = 0;
if( ( g_fGameOver ) && ( respawn_time < 1.0 ) ) if( ( g_fGameOver ) && ( respawn_time < 1.0 ) )
{ {
// if the game is over (time/frag limit) set the respawn time... // if the game is over (time/frag limit) set the respawn time...
respawn_time = 5.0; respawn_time = 5.0;
// check if any players are using the botcam... // cout total players
for( i = 1; i <= gpGlobals->maxClients; i++ ) for( i = 1; i <= gpGlobals->maxClients; i++ )
{ {
CBasePlayer *pPlayer = (CBasePlayer *)UTIL_PlayerByIndex( i ); CBasePlayer *pPlayer = (CBasePlayer *)UTIL_PlayerByIndex( i );
@ -1037,13 +1039,15 @@ void StartFrame( void )
if( !pPlayer ) if( !pPlayer )
continue; // if invalid then continue with next index... 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(); pPlayer->pBotCam->Disconnect();
count++; // count the number of bots and players
} }
} }
// check if a map was changed via "map" without kicking bots... // 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; bot_check_time = gpGlobals->time + 10.0;

Loading…
Cancel
Save