Actually remove duplicate message

This commit is contained in:
Learath 2020-06-12 16:25:58 +03:00
parent 465fd570e0
commit 939b45a0aa
2 changed files with 9 additions and 11 deletions

View file

@ -350,7 +350,7 @@ void CGameContext::SendChatTeam(int Team, const char *pText)
SendChatTarget(i, pText);
}
void CGameContext::SendChat(int ChatterClientID, int Team, const char *pText, int SpamProtectionClientID)
void CGameContext::SendChat(int ChatterClientID, int Team, const char *pText, int SpamProtectionClientID, int Flags)
{
if(SpamProtectionClientID >= 0 && SpamProtectionClientID < MAX_CLIENTS)
if(ProcessSpamProtection(SpamProtectionClientID))
@ -384,10 +384,8 @@ void CGameContext::SendChat(int ChatterClientID, int Team, const char *pText, in
// send to the clients
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(m_apPlayers[i] != 0) {
if(!m_apPlayers[i]->m_DND)
if(m_apPlayers[i] != 0 && !m_apPlayers[i]->m_DND && Server()->IsSixup(i) == (Flags & CHAT_SIXUP))
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_NORECORD, i);
}
}
}
else
@ -1086,11 +1084,8 @@ void CGameContext::OnClientEnter(int ClientID)
}
char aBuf[512];
if(!Server()->IsSixup(ClientID))
{
str_format(aBuf, sizeof(aBuf), "'%s' entered and joined the %s", Server()->ClientName(ClientID), m_pController->GetTeamName(m_apPlayers[ClientID]->GetTeam()));
SendChat(-1, CGameContext::CHAT_ALL, aBuf);
}
str_format(aBuf, sizeof(aBuf), "'%s' entered and joined the %s", Server()->ClientName(ClientID), m_pController->GetTeamName(m_apPlayers[ClientID]->GetTeam()));
SendChat(-1, CGameContext::CHAT_ALL, aBuf, -1, CHAT_SIX);
SendChatTarget(ClientID, "DDraceNetwork Mod. Version: " GAME_VERSION);
SendChatTarget(ClientID, "please visit DDNet.tw or say /info for more info");

View file

@ -191,14 +191,17 @@ public:
CHAT_RED=0,
CHAT_BLUE=1,
CHAT_WHISPER_SEND=2,
CHAT_WHISPER_RECV=3
CHAT_WHISPER_RECV=3,
CHAT_SIX=1<<0,
CHAT_SIXUP=1<<1,
};
// network
void CallVote(int ClientID, const char *aDesc, const char *aCmd, const char *pReason, const char *aChatmsg);
void SendChatTarget(int To, const char *pText);
void SendChatTeam(int Team, const char *pText);
void SendChat(int ClientID, int Team, const char *pText, int SpamProtectionClientID = -1);
void SendChat(int ClientID, int Team, const char *pText, int SpamProtectionClientID = -1, int Flags = CHAT_SIX | CHAT_SIXUP);
void SendEmoticon(int ClientID, int Emoticon);
void SendWeaponPickup(int ClientID, int Weapon);
void SendBroadcast(const char *pText, int ClientID, bool IsImportant = true);