const char *CHalfLifeTeamplay::SetDefaultPlayerTeam( CBasePlayer *pPlayer ) { // copy out the team name from the model char *mdls = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model" ); strncpy( pPlayer->m_szTeamName, mdls, TEAM_NAME_LENGTH ); RecountTeams(); // update the current player of the team he is joining if ( pPlayer->m_szTeamName[0] == '\0' || !IsValidTeam( pPlayer->m_szTeamName ) || defaultteam.value ) { const char *pTeamName = NULL; if ( defaultteam.value ) { pTeamName = team_names[0]; } else { pTeamName = TeamWithFewestPlayers(); } strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH ); } return pPlayer->m_szTeamName; }
const char *CHalfLifeTeamplay::SetDefaultPlayerTeam( CBasePlayer *pPlayer ) { // copy out the team name from the model char *mdls = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model" ); pPlayer->SetTeamID(mdls); RecountTeams(); // update the current player of the team he is joining const char* theTeamName = pPlayer->TeamID(); if ( theTeamName == '\0' || !IsValidTeam( theTeamName ) || defaultteam.value ) { const char *pTeamName = NULL; if ( defaultteam.value ) { pTeamName = team_names[0]; } else { pTeamName = TeamWithFewestPlayers(); } pPlayer->SetTeamID(pTeamName); } return pPlayer->TeamID(); }
const char *CTeamplayRules::SetDefaultPlayerTeam( CBasePlayer *pPlayer ) { // copy out the team name from the model char *mdls = engine->InfoKeyValue( engine->GetInfoKeyBuffer( pPlayer->edict() ), "model" ); pPlayer->SetTeamName( mdls ); RecountTeams(); // update the current player of the team he is joining if ( (pPlayer->TeamName())[0] == '\0' || !IsValidTeam( pPlayer->TeamName() ) || defaultteam.GetFloat() ) { const char *pTeamName = NULL; if ( defaultteam.GetFloat() ) { pTeamName = team_names[0]; } else { pTeamName = TeamWithFewestPlayers(); } pPlayer->SetTeamName( pTeamName ); } return pPlayer->TeamName(); }