added the possibility to have silent enter/leave messages. closes #1539

This commit is contained in:
oy 2018-11-19 16:12:54 +01:00
parent b9ea02d13f
commit 4584c16935
3 changed files with 15 additions and 7 deletions

View file

@ -322,6 +322,7 @@ Messages = [
NetArray(NetStringStrict("m_apSkinPartNames"), 6),
NetArray(NetBool("m_aUseCustomColors"), 6),
NetArray(NetIntAny("m_aSkinPartColors"), 6),
NetBool("m_Silent"),
]),
NetMessage("Sv_GameInfo", [
@ -337,6 +338,7 @@ Messages = [
NetMessage("Sv_ClientDrop", [
NetIntRange("m_ClientID", 0, 'MAX_CLIENTS-1'),
NetStringStrict("m_pReason"),
NetBool("m_Silent"),
]),
NetMessage("Sv_GameMsg", []),

View file

@ -627,7 +627,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
return;
}
if(m_LocalClientID != -1)
if(m_LocalClientID != -1 && !pMsg->m_Silent)
{
DoEnterMessage(pMsg->m_pName, pMsg->m_ClientID, pMsg->m_Team);
@ -676,13 +676,16 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
return;
}
if(!pMsg->m_Silent)
{
DoLeaveMessage(m_aClients[pMsg->m_ClientID].m_aName, pMsg->m_ClientID, pMsg->m_pReason);
CNetMsg_De_ClientLeave Msg;
Msg.m_pName = m_aClients[pMsg->m_ClientID].m_aName;
Msg.m_ClientID = pMsg->m_ClientID;
Msg.m_pReason = pMsg->m_pReason;
Client()->SendPackMsg(&Msg, MSGFLAG_NOSEND|MSGFLAG_RECORD);
Client()->SendPackMsg(&Msg, MSGFLAG_NOSEND | MSGFLAG_RECORD);
}
m_GameInfo.m_NumPlayers--;
// calculate team-balance

View file

@ -594,6 +594,7 @@ void CGameContext::OnClientEnter(int ClientID)
NewClientInfoMsg.m_pName = Server()->ClientName(ClientID);
NewClientInfoMsg.m_pClan = Server()->ClientClan(ClientID);
NewClientInfoMsg.m_Country = Server()->ClientCountry(ClientID);
NewClientInfoMsg.m_Silent = false;
for(int p = 0; p < 6; p++)
{
NewClientInfoMsg.m_apSkinPartNames[p] = m_apPlayers[ClientID]->m_TeeInfos.m_aaSkinPartNames[p];
@ -619,6 +620,7 @@ void CGameContext::OnClientEnter(int ClientID)
ClientInfoMsg.m_pName = Server()->ClientName(i);
ClientInfoMsg.m_pClan = Server()->ClientClan(i);
ClientInfoMsg.m_Country = Server()->ClientCountry(i);
ClientInfoMsg.m_Silent = false;
for(int p = 0; p < 6; p++)
{
ClientInfoMsg.m_apSkinPartNames[p] = m_apPlayers[i]->m_TeeInfos.m_aaSkinPartNames[p];
@ -681,6 +683,7 @@ void CGameContext::OnClientDrop(int ClientID, const char *pReason)
CNetMsg_Sv_ClientDrop Msg;
Msg.m_ClientID = ClientID;
Msg.m_pReason = pReason;
Msg.m_Silent = false;
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_NORECORD, -1);
}