From 8c5672831b2e577ca6b0ccb143b82ded59d9a391 Mon Sep 17 00:00:00 2001 From: Kacey2k Date: Thu, 23 Jul 2026 14:18:02 -0700 Subject: [PATCH] Add TF player team debug command --- src/game/client/tf/c_tf_playerresource.cpp | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/game/client/tf/c_tf_playerresource.cpp b/src/game/client/tf/c_tf_playerresource.cpp index 0a124122075..d682bfb4ddd 100644 --- a/src/game/client/tf/c_tf_playerresource.cpp +++ b/src/game/client/tf/c_tf_playerresource.cpp @@ -21,6 +21,72 @@ extern ConVar tf_mvm_buybacks_method; C_TF_PlayerResource *g_TF_PR; +//----------------------------------------------------------------------------- +// Purpose: Prints connected player identifiers and team assignments. +//----------------------------------------------------------------------------- +CON_COMMAND_F( tf_player_team_debug, "Prints player identifiers and team assignments.", FCVAR_CLIENTDLL ) +{ + if ( !g_TF_PR ) + { + return; + } + + Msg( "# userid uniqueid team_id team\n" ); + + for ( int i = 1; i <= MAX_PLAYERS; ++i ) + { + if ( !g_TF_PR->IsConnected( i ) ) + { + continue; + } + + const int iUserID = g_TF_PR->GetUserID( i ); + const uint32 unAccountID = g_TF_PR->GetAccountID( i ); + const int iTeam = g_TF_PR->GetTeam( i ); + + const char *pszTeamName = "Unknown"; + + switch ( iTeam ) + { + case TEAM_UNASSIGNED: + pszTeamName = "Unassigned"; + break; + + case TEAM_SPECTATOR: + pszTeamName = "Spectator"; + break; + + case TF_TEAM_RED: + pszTeamName = "RED"; + break; + + case TF_TEAM_BLUE: + pszTeamName = "BLU"; + break; + + default: + break; + } + + if ( g_TF_PR->IsFakePlayer( i ) ) + { + Msg( "# %6d %-18s %7d %s\n", + iUserID, "BOT", iTeam, pszTeamName ); + } + else + { + const CSteamID steamID( + unAccountID, + GetUniverse(), + k_EAccountTypeIndividual + ); + + Msg( "# %6d %-18s %7d %s\n", + iUserID, steamID.Render(), iTeam, pszTeamName ); + } + } +} + IMPLEMENT_CLIENTCLASS_DT( C_TF_PlayerResource, DT_TFPlayerResource, CTFPlayerResource ) RecvPropArray3( RECVINFO_ARRAY( m_iTotalScore ), RecvPropInt( RECVINFO( m_iTotalScore[0] ) ) ), RecvPropArray3( RECVINFO_ARRAY( m_iMaxHealth ), RecvPropInt( RECVINFO( m_iMaxHealth[0] ) ) ),