Quote:
Originally Posted by guipatinador
With get_user_team( ) you can get the team name (string).
|
Not a problem.
PHP Code:
_get_client_team( Index, Team[ ], Length )
{
if( !is_user_connected( Index ) )
return -1;
static const TeamNames[ ][ ] = { "UNASSIGNED", "TERRORIST", "CT", "SPECTATOR" };
static Team;
Team = cs_get_user_team( Index );
if( Length )
formatex( Team, Length, "%s", TeamNames[ Team ] );
return Team;
}
PHP Code:
// Returns the Counter-Strike purely team index
native cs_get_user_team( Client );
// Returns the team that is retrieved through different events like TeamInfo or ScoreInfo
native get_user_team( Client, Team[ ] = "", Length = 0 );
In my opinion, the best solution is retrieving the client's team index by
cs_get_user_team.
Fake Meta fast conversion:
PHP Code:
_get_client_team( Index )
{
static const OFFSET_CSTEAMS = 114;
return is_user_connected( Index ) ? get_pdata_int( Index, OFFSET_CSTEAMS ) : -1;
}
_set_client_team( Index, Team )
{
static const OFFSET_CSTEAMS = 114;
return is_user_connected( Index ) ? set_pdata_int( Index, OFFSET_CSTEAMS, Team ) : -1;
}
__________________