Skip to content

Commit 6f0a441

Browse files
committed
gameplay: fix class limit bypass from selecting class to spawn after death
this adds a check to ForceRespawn to make sure that the player indeed can choose this class the bypass happens because while you are still dead, you do not count against the class limit if you select a new class to spawn as so, two or more players can select the same class while dead, putting the team over the limit Ref: ValveSoftware/Source-1-Games#2084
1 parent 0f7c17b commit 6f0a441

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/game/server/tf/tf_player.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13893,6 +13893,14 @@ void CTFPlayer::ForceRespawn( void )
1389313893
DropFlag();
1389413894
}
1389513895

13896+
// Prevent bypassing class limits. Whoever wins on the draw can spawn as this class,
13897+
// and anyone who comes after will get swapped back to their old class.
13898+
if (!TFGameRules()->CanPlayerChooseClass(this, iDesiredClass))
13899+
{
13900+
iDesiredClass = GetPlayerClass()->GetClassIndex();
13901+
ClientPrint( this, HUD_PRINTCENTER, "#TF_ClassLimitReached" ); // NOTE: Add localization string
13902+
}
13903+
1389613904
if ( GetPlayerClass()->GetClassIndex() != iDesiredClass )
1389713905
{
1389813906
// clean up any pipebombs/buildings in the world (no explosions)

0 commit comments

Comments
 (0)