Skip to content

Commit

Permalink
Show team size when using /team
Browse files Browse the repository at this point in the history
  • Loading branch information
archimede67 committed Jun 16, 2024
1 parent 30b7659 commit a6cae61
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/game/server/ddracechat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,18 +1241,25 @@ void CGameContext::ConTeam(IConsole::IResult *pResult, void *pUserData)
char aBuf[512];
if(!pPlayer->IsPlaying())
{
pSelf->Console()->Print(
IConsole::OUTPUT_LEVEL_STANDARD,
"chatresp",
"You can't check your team while you are dead/a spectator.");
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp", "You can't check your team while you are dead/a spectator.");
}
else
{
str_format(
aBuf,
sizeof(aBuf),
"You are in team %d",
pSelf->GetDDRaceTeam(pResult->m_ClientId));
int TeamSize = 0;
const int PlayerTeam = pSelf->GetDDRaceTeam(pResult->m_ClientId);

// Count players in team
for(int ClientId = 0; ClientId < MAX_CLIENTS; ClientId++)
{
const CPlayer *pOtherPlayer = pSelf->m_apPlayers[ClientId];
if(!pOtherPlayer || !pOtherPlayer->IsPlaying())
continue;

if(pSelf->GetDDRaceTeam(ClientId) == PlayerTeam)
TeamSize++;
}

str_format(aBuf, sizeof(aBuf), "You are in team %d having %d %s", PlayerTeam, TeamSize, TeamSize > 1 ? "players" : "player");
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp", aBuf);
}
}
Expand Down

0 comments on commit a6cae61

Please sign in to comment.