From d5991b26787facf1780f58da051446e568633bf6 Mon Sep 17 00:00:00 2001 From: nemmy Date: Sun, 9 Nov 2025 04:02:08 -0500 Subject: [PATCH 1/2] Fix: assign players to a team immediately to stop malicious users --- src/game/client/tf/vgui/tf_mapinfomenu.cpp | 9 +++++++++ src/game/server/tf/tf_player.cpp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/game/client/tf/vgui/tf_mapinfomenu.cpp b/src/game/client/tf/vgui/tf_mapinfomenu.cpp index 0d5af08d209..3ea7e3d2182 100644 --- a/src/game/client/tf/vgui/tf_mapinfomenu.cpp +++ b/src/game/client/tf/vgui/tf_mapinfomenu.cpp @@ -296,6 +296,15 @@ void CTFMapInfoMenu::OnCommand( const char *command ) engine->ClientCmd( "team_ui_setup" ); } } + else + { + CTFPlayer* pPlayer = dynamic_cast< CTFPlayer* >( C_BasePlayer::GetLocalPlayer() ); + C_TFPlayerClass* pClass = pPlayer ? pPlayer->GetPlayerClass() : NULL; + if ( pClass && pClass->GetClassIndex() == TF_CLASS_UNDEFINED ) + { + m_pViewPort->ShowPanel( ( pPlayer->GetTeamNumber() == TF_TEAM_BLUE ) ? PANEL_CLASS_BLUE : PANEL_CLASS_RED, true ); + } + } UTIL_IncrementMapKey( "viewed" ); } diff --git a/src/game/server/tf/tf_player.cpp b/src/game/server/tf/tf_player.cpp index fa944e35611..9760790185f 100644 --- a/src/game/server/tf/tf_player.cpp +++ b/src/game/server/tf/tf_player.cpp @@ -13663,6 +13663,15 @@ void CTFPlayer::StateEnterWELCOME( void ) } m_bSeenRoundInfo = false; + + if ( ShouldForceAutoTeam() && GetTeamNumber() == TEAM_UNASSIGNED ) + { + // Players are not considered to be on a team until they click continue on the MOTD screen + // Players not on a team do not show up in the vote UI, malicious players are currently clogging up slots and avoiding vote kicks by never clicking continue + // MvM already has a specific fix for this by allowing players to kick unassigned players but that doesn't work in regular modes, this is a proper fix for all modes + int iTeam = GetAutoTeam(); + ChangeTeam( iTeam, true, false ); + } } } From 59e67d24adbd096010839786498187ec27a47fb3 Mon Sep 17 00:00:00 2001 From: nemmy Date: Mon, 10 Nov 2025 10:40:37 -0500 Subject: [PATCH 2/2] Use ToTfPlayer --- src/game/client/tf/vgui/tf_mapinfomenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/client/tf/vgui/tf_mapinfomenu.cpp b/src/game/client/tf/vgui/tf_mapinfomenu.cpp index 3ea7e3d2182..39cd966277e 100644 --- a/src/game/client/tf/vgui/tf_mapinfomenu.cpp +++ b/src/game/client/tf/vgui/tf_mapinfomenu.cpp @@ -298,7 +298,7 @@ void CTFMapInfoMenu::OnCommand( const char *command ) } else { - CTFPlayer* pPlayer = dynamic_cast< CTFPlayer* >( C_BasePlayer::GetLocalPlayer() ); + CTFPlayer* pPlayer = ToTFPlayer( C_BasePlayer::GetLocalPlayer() ); C_TFPlayerClass* pClass = pPlayer ? pPlayer->GetPlayerClass() : NULL; if ( pClass && pClass->GetClassIndex() == TF_CLASS_UNDEFINED ) {