Untested
PHP Code:
//Usage
new iLastT = GetLastPlayer( CS_TEAM_T );
//If iLastT > 0 then there is only one T left and his id is stored in iLastT
if ( iLastT )
{
}
//If iLastT = 0 there are either no T's or more than one
else
{
}
//the function
public GetLastPlayer( CsTeams:Team )
{
new iPlayers[ 32 ] , iNum , id , iLastT;
get_players( iPlayers , iNum );
for ( new i = 0 ; i < iNum ; i++ )
{
id = iPlayers[ i ];
if ( is_user_alive( id ) && ( cs_get_user_team( id ) == Team ) )
{
if ( iLastT )
return 0;
iLastT = id;
}
}
return iLastT;
}
__________________