All pastes #387278 Raw Edit

Untitled

public cpp v1 · immutable
·published 2007-03-09 06:27 UTC
rendered paste body
int CPlayerManager::iGetTeams( hud_player_info_t player_info ) {	if( strstr( player_info.model, "gign" ) || strstr( player_info.model, "sas" ) ||		strstr( player_info.model, "gsg9" ) || strstr( player_info.model, "urban" ) ||		strstr( player_info.model, "urban" ) || strstr( player_info.model, "brit" ) )		return 1;	else if( strstr( player_info.model, "vip" ) ) return 3;	else return 2;}void CPlayerManager::SetColors( hud_player_info_t players_to_set ) {	int iTeams = iGetTeams( players_to_set );	if( iTeams == 1 ) {		m_flColors[ 0 ] = 0;		m_flColors[ 1 ] = 0;		m_flColors[ 2 ] = 255;	}	else if( iTeams == 2 ) {		m_flColors[ 0 ] = 255;		m_flColors[ 1 ] = 0;		m_flColors[ 2 ] = 0;	}	else if( iTeams == 3 ) {		m_flColors[ 0 ] = 92;		m_flColors[ 1 ] = 222;		m_flColors[ 2 ] = 216;	}	else {		m_flColors[ 0 ] = 255;		m_flColors[ 1 ] = 255;		m_flColors[ 2 ] = 255;	}}float CPlayerManager::flGetColors( int iColorIdx ) {	return m_flColors[ iColorIdx ];}if( m_bInGame ) {		hud_player_info_t PlayerInfo;		float flCoords[ 3 ] = { 0 };		int i;		for( i = 0; i < 32; i++ ) {			//Do( "Executing Loop" );			cl_entity_s *pEnts = g_pEngine->GetEntityByIndex( i );			//Do( "GetEntByIndex Called" );			g_pEngine->pfnGetPlayerInfo( i, &PlayerInfo );			//Do( "GetPlayerInfo called" );			if( pEnts == NULL ) continue;			if( pPlayers->bIsEntValid( pEnts ) == false ) continue;			if( PlayerInfo.model == NULL || PlayerInfo.model == NULL ) continue;			if( pPlayers->CalcScreen( pEnts->origin, flCoords ) ) {				int iTeams = pPlayers->iGetTeams( PlayerInfo );				//Do( "Getting teams" );				pPlayers->SetColors( PlayerInfo );				//Do( "Setting colors" );				if( iTeams == 2 )					DrawBox( flCoords[ 0 ], flCoords[ 1 ], pPlayers->flGetColors( 0 ),														   pPlayers->flGetColors( 1 ),														   pPlayers->flGetColors( 2 ),														   160,														   10 );			}		}	}