mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
removed chat spam for the team commands
This commit is contained in:
parent
ed4158e837
commit
11cc0e78d7
|
@ -1066,12 +1066,12 @@ void CGameContext::ConSetTeamAll(IConsole::IResult *pResult, void *pUserData)
|
|||
int Team = clamp(pResult->GetInteger(0), -1, 1);
|
||||
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "moved all clients to team %d", Team);
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
|
||||
str_format(aBuf, sizeof(aBuf), "All players were moved to the %s", pSelf->m_pController->GetTeamName(Team));
|
||||
pSelf->SendChat(-1, CGameContext::CHAT_ALL, aBuf);
|
||||
|
||||
for(int i = 0; i < MAX_CLIENTS; ++i)
|
||||
if(pSelf->m_apPlayers[i])
|
||||
pSelf->m_apPlayers[i]->SetTeam(Team);
|
||||
pSelf->m_apPlayers[i]->SetTeam(Team, false);
|
||||
|
||||
(void)pSelf->m_pController->CheckTeamBalance();
|
||||
}
|
||||
|
@ -1082,12 +1082,12 @@ void CGameContext::ConSwapTeams(IConsole::IResult *pResult, void *pUserData)
|
|||
if(!pSelf->m_pController->IsTeamplay())
|
||||
return;
|
||||
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", "swapped the current teams");
|
||||
pSelf->SendChat(-1, CGameContext::CHAT_ALL, "Teams were swapped");
|
||||
|
||||
for(int i = 0; i < MAX_CLIENTS; ++i)
|
||||
{
|
||||
if(pSelf->m_apPlayers[i] && pSelf->m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS)
|
||||
pSelf->m_apPlayers[i]->SetTeam(pSelf->m_apPlayers[i]->GetTeam()^1);
|
||||
pSelf->m_apPlayers[i]->SetTeam(pSelf->m_apPlayers[i]->GetTeam()^1, false);
|
||||
}
|
||||
|
||||
(void)pSelf->m_pController->CheckTeamBalance();
|
||||
|
@ -1107,26 +1107,26 @@ void CGameContext::ConShuffleTeams(IConsole::IResult *pResult, void *pUserData)
|
|||
++PlayerTeam;
|
||||
PlayerTeam = (PlayerTeam+1)/2;
|
||||
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", "shuffled the current teams");
|
||||
pSelf->SendChat(-1, CGameContext::CHAT_ALL, "Teams were shuffled");
|
||||
|
||||
for(int i = 0; i < MAX_CLIENTS; ++i)
|
||||
{
|
||||
if(pSelf->m_apPlayers[i] && pSelf->m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS)
|
||||
{
|
||||
if(CounterRed == PlayerTeam)
|
||||
pSelf->m_apPlayers[i]->SetTeam(TEAM_BLUE);
|
||||
pSelf->m_apPlayers[i]->SetTeam(TEAM_BLUE, false);
|
||||
else if(CounterBlue == PlayerTeam)
|
||||
pSelf->m_apPlayers[i]->SetTeam(TEAM_RED);
|
||||
pSelf->m_apPlayers[i]->SetTeam(TEAM_RED, false);
|
||||
else
|
||||
{
|
||||
if(rand() % 2)
|
||||
{
|
||||
pSelf->m_apPlayers[i]->SetTeam(TEAM_BLUE);
|
||||
pSelf->m_apPlayers[i]->SetTeam(TEAM_BLUE, false);
|
||||
++CounterBlue;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSelf->m_apPlayers[i]->SetTeam(TEAM_RED);
|
||||
pSelf->m_apPlayers[i]->SetTeam(TEAM_RED, false);
|
||||
++CounterRed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ void CPlayer::Respawn()
|
|||
m_Spawning = true;
|
||||
}
|
||||
|
||||
void CPlayer::SetTeam(int Team)
|
||||
void CPlayer::SetTeam(int Team, bool DoChatMsg)
|
||||
{
|
||||
// clamp the team
|
||||
Team = GameServer()->m_pController->ClampTeam(Team);
|
||||
|
@ -238,8 +238,11 @@ void CPlayer::SetTeam(int Team)
|
|||
return;
|
||||
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "'%s' joined the %s", Server()->ClientName(m_ClientID), GameServer()->m_pController->GetTeamName(Team));
|
||||
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aBuf);
|
||||
if(DoChatMsg)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "'%s' joined the %s", Server()->ClientName(m_ClientID), GameServer()->m_pController->GetTeamName(Team));
|
||||
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aBuf);
|
||||
}
|
||||
|
||||
KillCharacter();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
|
||||
void TryRespawn();
|
||||
void Respawn();
|
||||
void SetTeam(int Team);
|
||||
void SetTeam(int Team, bool DoChatMsg=true);
|
||||
int GetTeam() const { return m_Team; };
|
||||
int GetCID() const { return m_ClientID; };
|
||||
|
||||
|
|
Loading…
Reference in a new issue