Find CCSPlayerController_SwitchTeam
Locate CCSPlayerController_SwitchTeam in CS2 server.dll or server.so using IDA Pro MCP tools.
Method
Search for the debug string:
mcp__ida-pro-mcp__find_regex pattern="SwitchTeam => ChangeBasePlayerTeamAndPendingTeam"Get cross-references to the string:
mcp__ida-pro-mcp__xrefs_to addrs="<string_addr>"The string is referenced in an internal function. Get cross-references to that function to find the public wrapper:
mcp__ida-pro-mcp__xrefs_to addrs="<internal_function_addr>"Look for a small wrapper function (~0x5d bytes) that:
- Validates team index (checks if team is 2 or 3)
- Prints error if invalid:
"CCSPlayerPawnBase::SwitchTeam( %d ) - invalid team index.\n" - Calls the internal function if team is valid and different from current team
Decompile the wrapper function:
mcp__ida-pro-mcp__decompile addr="<wrapper_function_addr>"Rename the function:
mcp__ida-pro-mcp__rename batch={"func": [{"addr": "<wrapper_function_addr>", "name": "CCSPlayerController_SwitchTeam"}]}Generate and validate unique signature:
ALWAYS Use SKILL
/generate-signature-for-functionto generate a robust and unique signature for the function.Write IDA analysis output as YAML beside the binary:
ALWAYS Use SKILL
/write-func-as-yamlto write the analysis results.Required parameters:
func_name:CCSPlayerController_SwitchTeamfunc_addr: The function address from step 5func_sig: The validated signature from step 7
Note: This is NOT a virtual function, so no vtable parameters are needed.
Signature Pattern
The function references two debug strings:
- Internal function:
"%s<%i><%s><%s>" SwitchTeam => ChangeBasePlayerTeamAndPendingTeam =%d , req team %d %.2f \n - Wrapper function:
"CCSPlayerPawnBase::SwitchTeam( %d ) - invalid team index.\n"
Function Characteristics
- Parameters:
(this, team_id)wherethisis CCSPlayerController pointer,team_idis the target team - Validation: Checks if team_id is 2 (Terrorist) or 3 (Counter-Terrorist)
- Behavior: Only calls internal switch if new team differs from current team (offset 0x624)
Function Structure
__int64 CCSPlayerController_SwitchTeam(__int64 this, unsigned int team_id)
{
if ( !ValidateTeam(team_id) || team_id - 2 > 1 )
return PrintError("CCSPlayerPawnBase::SwitchTeam( %d ) - invalid team index.\n", team_id);
current_team = *(unsigned __int8 *)(this + 0x624); // m_iTeamNum offset
if ( team_id != current_team )
return CCSPlayerController_SwitchTeam_Internal(this, team_id);
return current_team;
}
Team IDs
0: Unassigned1: Spectator2: Terrorist3: Counter-Terrorist
Output YAML Format
The output YAML filename depends on the platform:
server.dll→CCSPlayerController_SwitchTeam.windows.yamlserver.so→CCSPlayerController_SwitchTeam.linux.yaml
func_va: 0x137A0A0 # Virtual address of the function - This can change when game updates.
func_rva: 0x137A0A0 # Relative virtual address (VA - image base) - This can change when game updates.
func_size: 0x5d # Function size in bytes - This can change when game updates.
func_sig: XX XX XX XX XX # Unique byte signature for pattern scanning - This can change when game updates.