From c9c01c7da7e8d71e1be02c855489d544b0e4956e Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 14 Jan 2024 07:24:14 +0200 Subject: [PATCH] add respawn delay to prevent server crash --- dlls/client.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/client.cpp b/dlls/client.cpp index 3e8897ae..11fe195d 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -1372,12 +1372,16 @@ void StartFrame( void ) { for( i = 0; i < 32; i++ ) { - if( !bot_respawn[i].is_used && bot_respawn[i].state == BOT_NEED_TO_RESPAWN) + if( !bot_respawn[i].is_used && + bot_respawn[i].state == BOT_NEED_TO_RESPAWN && + gpGlobals->time >= respawn_time) { bot_respawn[i].state = BOT_IS_RESPAWNING; bot_respawn[i].is_used = FALSE; // free up this slot BotCreate( bot_respawn[i].skin, bot_respawn[i].name, bot_respawn[i].skill ); + + respawn_time = gpGlobals->time + 1.0; // set next respawn time (to prevent server crash) break; } }