Print message when team starts playing to team members

This commit is contained in:
def 2017-07-29 23:11:33 +02:00
parent 50a397e32c
commit f3d4fcf012

View file

@ -82,6 +82,17 @@ void CGameTeams::OnCharacterStart(int ClientID)
if (m_TeamState[m_Core.Team(ClientID)] < TEAMSTATE_STARTED && !Waiting)
{
ChangeTeamState(m_Core.Team(ClientID), TEAMSTATE_STARTED);
char aBuf[512];
str_format(
aBuf,
sizeof(aBuf),
"Team %d started with these %d players: ",
m_Core.Team(ClientID),
Count(m_Core.Team(ClientID)));
bool First = true;
for (int i = 0; i < MAX_CLIENTS; ++i)
{
if (m_Core.Team(ClientID) == m_Core.Team(i))
@ -92,6 +103,23 @@ void CGameTeams::OnCharacterStart(int ClientID)
{
SetDDRaceState(pPlayer, DDRACE_STARTED);
SetStartTime(pPlayer, Tick);
if (First)
First = false;
else
str_append(aBuf, ", ", sizeof(aBuf));
str_append(aBuf, GameServer()->Server()->ClientName(i), sizeof(aBuf));
}
}
}
for (int i = 0; i < MAX_CLIENTS; ++i)
{
CPlayer* pPlayer = GetPlayer(i);
if (m_Core.Team(ClientID) == m_Core.Team(i) && pPlayer && (pPlayer->IsPlaying() || TeamLocked(m_Core.Team(ClientID))))
{
GameServer()->SendChatTarget(i, aBuf);
}
}
}