View Single Post
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-27-2010 , 12:04   Re: game_team_master&game_team_set Fix (CS 1.6)
Reply With Quote #8

After some checks, the code is the same as HL1, so like you can see in HLSDK :

Code:
void CGameTeamMaster::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) {     if ( !CanFireForActivator( pActivator ) )         return;     if ( useType == USE_SET )     {         if ( value < 0 )         {             m_teamIndex = -1;         }         else         {             m_teamIndex = g_pGameRules->GetTeamIndex( pActivator->TeamID() );         }         return;     }     if ( TeamMatch( pActivator ) )     {         SUB_UseTargets( pActivator, triggerType, value );         if ( RemoveOnFire() )             UTIL_Remove( this );     } }
Code:
const char *CGameTeamMaster::TeamID( void ) {     if ( m_teamIndex < 0 )    // Currently set to "no team"         return "";     return g_pGameRules->GetIndexedTeamName( m_teamIndex );  // UNDONE: Fill this in with the team from the "teamlist" }
Code:
BOOL CGameTeamMaster::TeamMatch( CBaseEntity *pActivator ) {     if ( m_teamIndex < 0 && AnyTeam() )         return TRUE;     if ( !pActivator )         return FALSE;     return UTIL_TeamsMatch( pActivator->TeamID(), TeamID() ); }

The problem is in UTIL_TeamsMatch(), because CBaseEntity::TeamID() and CGameTeamMaster::TeamID() return "" in CS. So yes, you can put any teamindex value, it will return always "", thus the check UTIL_TeamsMatch() always true.

As solution, you can hook CGameTeamMaster::TeamMatch() with Orpheu and redo the function and checking manually with the offset 35 (m_teamIndex) and cs_get_user_team for activor.

EDIT : I was writting the signature of the function when i've seen that in the windows decompiled code, the function is integrated as inline into CGameTeamMaster::Use(). Meaning, for windows It would need to redo the Use() function... :/ Will do it later, anyway.
__________________

Last edited by Arkshine; 08-27-2010 at 12:07.
Arkshine is offline