void CHL2MP_Player::SetPlayerModelEx(const char* modelName)
{
	SetModel(modelName);
	SetupPlayerSoundsByModel(modelName);

	m_flNextModelChangeTime = gpGlobals->curtime + MODEL_CHANGE_INTERVAL;
}
void CHL2MP_Player::SetPlayerTeamModel( void )
{
	const char *szModelName = NULL;
	szModelName = engine->GetClientConVarValue( engine->IndexOfEdict( edict() ), "cl_playermodel" );
	
	SetModel( szModelName );
	SetupPlayerSoundsByModel( szModelName );

	m_flNextModelChangeTime = gpGlobals->curtime + MODEL_CHANGE_INTERVAL;
}
Ejemplo n.º 3
0
void CHL2MP_Player::SetPlayerTeamModel( void )
{
	const char *szModelName = NULL;
	szModelName = engine->GetClientConVarValue( engine->IndexOfEdict( edict() ), "cl_playermodel" );

	int modelIndex = modelinfo->GetModelIndex( szModelName );

	if ( modelIndex == -1 || ValidatePlayerModel( szModelName ) == false )
	{
		szModelName = "models/Combine_Soldier.mdl";
		m_iModelType = TEAM_COMBINE;

		char szReturnString[512];

		Q_snprintf( szReturnString, sizeof (szReturnString ), "cl_playermodel %s\n", szModelName );
		engine->ClientCommand ( edict(), szReturnString );
	}

	if ( GetTeamNumber() == TEAM_COMBINE )
	{
		if ( Q_stristr( szModelName, "models/human") )
		{
			int nHeads = ARRAYSIZE( g_ppszRandomCombineModels );
		
			g_iLastCombineModel = ( g_iLastCombineModel + 1 ) % nHeads;
			szModelName = g_ppszRandomCombineModels[g_iLastCombineModel];
		}

		m_iModelType = TEAM_COMBINE;
	}
	else if ( GetTeamNumber() == TEAM_REBELS )
	{
		if ( !Q_stristr( szModelName, "models/human") )
		{
			int nHeads = ARRAYSIZE( g_ppszRandomCitizenModels );

			g_iLastCitizenModel = ( g_iLastCitizenModel + 1 ) % nHeads;
			szModelName = g_ppszRandomCitizenModels[g_iLastCitizenModel];
		}

		m_iModelType = TEAM_REBELS;
	}
	
	SetModel( szModelName );
	SetupPlayerSoundsByModel( szModelName );

	m_flNextModelChangeTime = gpGlobals->curtime + MODEL_CHANGE_INTERVAL;
}
Ejemplo n.º 4
0
void CHL2MP_Player::SetPlayerTeamModel( void )
{
	const char *szModelName = NULL;
	szModelName = engine->GetClientConVarValue( engine->IndexOfEdict( edict() ), "cl_playermodel" );

	int modelIndex = modelinfo->GetModelIndex( szModelName );

	if ( modelIndex == -1 || ValidatePlayerModel( szModelName ) == false )
	{
		szModelName = "models/player/carebear.mdl";
		m_nSkin = toSkinId(PLAYER_SKIN_ROSE);
		m_iModelType = TEAM_PINK;

		char szReturnString[512];

		Q_snprintf( szReturnString, sizeof (szReturnString ), "cl_playermodel %s\n", szModelName );
		engine->ClientCommand ( edict(), szReturnString );
	}

	if ( GetTeamNumber() == TEAM_PINK )
	{
		if ( m_nSkin != toSkinId(PLAYER_SKIN_ROSE) )
		{
			szModelName = g_ppszRandomCombineModels[0];
			m_nSkin = 0;
		}

		m_iModelType = TEAM_PINK;
	}
	else if ( GetTeamNumber() == TEAM_GREEN )
	{
		if ( m_nSkin !=  toSkinId(PLAYER_SKIN_VERT))
		{
			szModelName = g_ppszRandomCitizenModels[0];
			m_nSkin = toSkinId(PLAYER_SKIN_VERT);
		}

		m_iModelType = TEAM_GREEN;
	}
	
	SetModel( szModelName );
	SetupPlayerSoundsByModel( szModelName );

	m_flNextModelChangeTime = gpGlobals->curtime + MODEL_CHANGE_INTERVAL;
}
Ejemplo n.º 5
0
void CHL2MP_Player::SetPlayerModel( void )
{
	const char *szModelName = NULL;
	const char *pszCurrentModelName = modelinfo->GetModelName( GetModel());

	szModelName = engine->GetClientConVarValue( engine->IndexOfEdict( edict() ), "cl_playermodel" );

	if ( ValidatePlayerModel( szModelName ) == false )
	{
		char szReturnString[512];

		if ( ValidatePlayerModel( pszCurrentModelName ) == false )
		{
			//DHL - Skillet - Changed from combine soldier
			pszCurrentModelName = DHL_DEFAULTMODEL;
		}

		Q_snprintf( szReturnString, sizeof (szReturnString ), "cl_playermodel %s\n", pszCurrentModelName );
		engine->ClientCommand ( edict(), szReturnString );

		szModelName = pszCurrentModelName;
	}

	//DHL - Skillet
	bool bUpdateCVAR = false;
	int nCount = ARRAYSIZE( ppszDHLExcludedSubStrs );
	for ( int i = 0; i < nCount; ++i )
	{
		if ( Q_stristr( szModelName, ppszDHLExcludedSubStrs[i] ) )
		{
			szModelName = DHL_DEFAULTMODEL;
			bUpdateCVAR = true;
			break;
		}
	}

	if ( DHLRules()->IsTeamplay() )
	{
		if ( GetTeamNumber() == TEAM_MOBSTERS )
		{
			if ( Q_stristr( szModelName, "models/player/dhl/mobsters" ) )
				m_iModelType = TEAM_MOBSTERS;
			else
				szModelName = DHL_DEFAULTMODEL_MOB;
		}
		else if ( GetTeamNumber() == TEAM_PROS )
		{
			if ( Q_stristr( szModelName, "models/player/dhl/professionals" ) )
				m_iModelType = TEAM_PROS;
			else
				szModelName = DHL_DEFAULTMODEL_PRO;
		}
	}
	if ( Q_strlen( szModelName ) == 0 )
	{
		szModelName = DHL_DEFAULTMODEL;
		bUpdateCVAR = true;
	}

	if ( bUpdateCVAR )
	{
		char szReturnString[512];
		Q_snprintf( szReturnString, sizeof (szReturnString), "cl_playermodel %s\n", szModelName );
		engine->ClientCommand ( edict(), szReturnString );
	}
	//DHL - Skillet - Obselete
	/*if ( GetTeamNumber() == TEAM_COMBINE )
	{
		int nHeads = ARRAYSIZE( g_ppszRandomCombineModels );
		
		g_iLastCombineModel = ( g_iLastCombineModel + 1 ) % nHeads;
		szModelName = g_ppszRandomCombineModels[g_iLastCombineModel];

		m_iModelType = TEAM_COMBINE;
	}
	else if ( GetTeamNumber() == TEAM_REBELS )
	{
		int nHeads = ARRAYSIZE( g_ppszRandomCitizenModels );

		g_iLastCitizenModel = ( g_iLastCitizenModel + 1 ) % nHeads;
		szModelName = g_ppszRandomCitizenModels[g_iLastCitizenModel];

		m_iModelType = TEAM_REBELS;
	}
	else
	{
		if ( Q_strlen( szModelName ) == 0 ) 
		{
			szModelName = g_ppszRandomCitizenModels[0];
		}

		if ( Q_stristr( szModelName, "models/human") )
		{
			m_iModelType = TEAM_REBELS;
		}
		else
		{
			m_iModelType = TEAM_COMBINE;
		}
	}*/

	int modelIndex = modelinfo->GetModelIndex( szModelName );

	if ( modelIndex == -1 )
	{
		//DHL - Skillet - Changed from combine soldier
		szModelName = DHL_DEFAULTMODEL;
		m_iModelType = TEAM_PROS;

		char szReturnString[512];

		Q_snprintf( szReturnString, sizeof (szReturnString ), "cl_playermodel %s\n", szModelName );
		engine->ClientCommand ( edict(), szReturnString );
	}

	SetModel( szModelName );
	SetupPlayerSoundsByModel( szModelName );

	m_flNextModelChangeTime = gpGlobals->curtime + MODEL_CHANGE_INTERVAL;
}
Ejemplo n.º 6
0
void CHL2MP_Player::SetPlayerTeamModel( void )
{
	const char *szModelName = NULL;
	szModelName = engine->GetClientConVarValue( engine->IndexOfEdict( edict() ), "cl_playermodel" );

	int modelIndex = modelinfo->GetModelIndex( szModelName );

	if ( modelIndex == -1 || ValidatePlayerModel( szModelName ) == false )
	{
		//DHL - Skillet - Changed from combine soldier
		szModelName = DHL_DEFAULTMODEL;
		m_iModelType = TEAM_PROS;

		char szReturnString[512];

		Q_snprintf( szReturnString, sizeof (szReturnString ), "cl_playermodel %s\n", szModelName );
		engine->ClientCommand ( edict(), szReturnString );
	}

	//DHL - Skillet
	if ( GetTeamNumber() == TEAM_MOBSTERS )
	{
		if ( !Q_stristr( szModelName, "models/player/dhl/mobsters" ) )
			szModelName = DHL_DEFAULTMODEL_MOB;
	}
	if ( GetTeamNumber() == TEAM_PROS )
	{
		if ( !Q_stristr( szModelName, "models/player/dhl/professionals" ) )
			szModelName = DHL_DEFAULTMODEL_PRO;
	}

	//DHL - Skillet - Obselete
	//if ( GetTeamNumber() == TEAM_COMBINE )
	//{
	//	if ( Q_stristr( szModelName, "models/human") )
	//	{
	//		int nHeads = ARRAYSIZE( g_ppszRandomCombineModels );
	//	
	//		g_iLastCombineModel = ( g_iLastCombineModel + 1 ) % nHeads;
	//		szModelName = g_ppszRandomCombineModels[g_iLastCombineModel];
	//	}

	//	m_iModelType = TEAM_COMBINE;
	//}
	//else if ( GetTeamNumber() == TEAM_REBELS )
	//{
	//	if ( !Q_stristr( szModelName, "models/human") )
	//	{
	//		int nHeads = ARRAYSIZE( g_ppszRandomCitizenModels );

	//		g_iLastCitizenModel = ( g_iLastCitizenModel + 1 ) % nHeads;
	//		szModelName = g_ppszRandomCitizenModels[g_iLastCitizenModel];
	//	}

	//	m_iModelType = TEAM_REBELS;
	//}
	
	SetModel( szModelName );
	SetupPlayerSoundsByModel( szModelName );

	m_flNextModelChangeTime = gpGlobals->curtime + MODEL_CHANGE_INTERVAL;
}
Ejemplo n.º 7
0
void CHL2MP_Player::SetPlayerModel( void )
{
	const char *szModelName = NULL;
	const char *pszCurrentModelName = modelinfo->GetModelName( GetModel());

	szModelName = engine->GetClientConVarValue( engine->IndexOfEdict( edict() ), "cl_playermodel" );

	if ( ValidatePlayerModel( szModelName ) == false )
	{
		char szReturnString[512];

		if ( ValidatePlayerModel( pszCurrentModelName ) == false )
			pszCurrentModelName = "models/player/carebear.mdl";

		Q_snprintf( szReturnString, sizeof (szReturnString ), "cl_playermodel %s\n", pszCurrentModelName );
		engine->ClientCommand ( edict(), szReturnString );

		szModelName = pszCurrentModelName;
	}

	if ( GetTeamNumber() == TEAM_PINK )
	{
		m_nSkin = 0;
		m_iModelType = TEAM_PINK;
		szModelName = g_ppszRandomCitizenModels[0];
	}
	else if ( GetTeamNumber() == TEAM_GREEN )
	{
		m_nSkin = 2;
		m_iModelType = TEAM_GREEN;
		szModelName = g_ppszRandomCitizenModels[0];
	}
	else
	{
		if ( Q_strlen( szModelName ) == 0 ) 
			szModelName = g_ppszRandomCitizenModels[0];

		if ( m_nSkin == 2 )
			m_iModelType = TEAM_GREEN;
		else
			m_iModelType = TEAM_PINK;
	}

	int modelIndex = modelinfo->GetModelIndex( szModelName );

	if ( modelIndex == -1 )
	{
		szModelName = "models/player/carebear.mdl";
		m_iModelType = TEAM_PINK;
		m_nSkin = 0;

		char szReturnString[512];

		Q_snprintf( szReturnString, sizeof (szReturnString ), "cl_playermodel %s\n", szModelName );
		engine->ClientCommand ( edict(), szReturnString );
	}

	SetModel( szModelName );
	SetupPlayerSoundsByModel( szModelName );

	m_flNextModelChangeTime = gpGlobals->curtime + MODEL_CHANGE_INTERVAL;
}