Skip to content

Commit

Permalink
fixed small bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AssassinTee committed Apr 27, 2019
1 parent 3fda2de commit 93aa884
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/game/server/gamecontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,9 +911,9 @@ void CGameContext::SetStartTeam(int ClientID)
{
//count people per teamid
std::map<int, int> teamcounts;
for(int i = 0; i < MAX_CLIENTS; i++)
for(int i = 0; i < MAX_PLAYERS; i++)
{
if(m_apPlayers[i])
if(m_apPlayers[i] && m_apPlayers[i]->GetTeamID() >= 0 && Server()->ClientIngame(i))
{
teamcounts[m_apPlayers[i]->GetTeamID()]++;
}
Expand All @@ -940,6 +940,9 @@ void CGameContext::SetStartTeam(int ClientID)
int randomteam = resultteams[rand()%(resultteams.size())];
m_apPlayers[ClientID]->SetTeamID(randomteam);
copy_skin(m_apPlayers[ClientID]->m_TeeInfos, m_apPlayers[randomteam]->m_TeeInfosOriginal);
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "set startteam of player '%s' to '%d'", Server()->ClientName(ClientID), randomteam);
Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "server", aBuf);
}
}

Expand Down

0 comments on commit 93aa884

Please sign in to comment.