From 95b1790ffe7f82d110942035e9cfbbfc0acc92ba Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 12 May 2022 02:53:59 +0200 Subject: [PATCH] Check .bot_forced_team validity immediately --- qcsrc/server/bot/default/bot.qc | 4 ++++ qcsrc/server/client.qc | 9 ++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index 792bde7cd..890cb6e42 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -243,7 +243,11 @@ void bot_setnameandstuff(entity this) else bot_pants = ftos(floor(random() * 15)); if (teamplay && !(autocvar_bot_vs_human && AvailableTeams() == 2)) + { this.bot_forced_team = stof(argv(5)); + if (!Team_IsValidIndex(this.bot_forced_team)) + this.bot_forced_team = 0; + } else this.bot_forced_team = 0; diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 7bd24369e..2e6e9e6b8 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -540,13 +540,8 @@ void PutPlayerInServer(entity this) PlayerState_attach(this); accuracy_resend(this); - if (IS_BOT_CLIENT(this)) - { - if (teamplay && Team_IsValidIndex(this.bot_forced_team)) - SetPlayerTeam(this, this.bot_forced_team, TEAM_CHANGE_MANUAL); - else - this.bot_forced_team = 0; - } + if (teamplay && this.bot_forced_team) + SetPlayerTeam(this, this.bot_forced_team, TEAM_CHANGE_MANUAL); if (this.team < 0) TeamBalance_JoinBestTeam(this); -- 2.39.2