mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 06:58:20 +00:00
Disallow player name changes when the player is muted
This commit is contained in:
parent
0689466002
commit
5b4c64005f
|
@ -2176,16 +2176,23 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
|
||||||
Server()->SetClientName(ClientID, pMsg->m_pName);
|
Server()->SetClientName(ClientID, pMsg->m_pName);
|
||||||
if(str_comp(aOldName, Server()->ClientName(ClientID)) != 0)
|
if(str_comp(aOldName, Server()->ClientName(ClientID)) != 0)
|
||||||
{
|
{
|
||||||
char aChatText[256];
|
if(ProcessSpamProtection(ClientID))
|
||||||
str_format(aChatText, sizeof(aChatText), "'%s' changed name to '%s'", aOldName, Server()->ClientName(ClientID));
|
{
|
||||||
SendChat(-1, CGameContext::CHAT_ALL, aChatText);
|
Server()->SetClientName(ClientID, aOldName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char aChatText[256];
|
||||||
|
str_format(aChatText, sizeof(aChatText), "'%s' changed name to '%s'", aOldName, Server()->ClientName(ClientID));
|
||||||
|
SendChat(-1, CGameContext::CHAT_ALL, aChatText);
|
||||||
|
|
||||||
// reload scores
|
// reload scores
|
||||||
Score()->PlayerData(ClientID)->Reset();
|
Score()->PlayerData(ClientID)->Reset();
|
||||||
m_apPlayers[ClientID]->m_Score = -9999;
|
m_apPlayers[ClientID]->m_Score = -9999;
|
||||||
Score()->LoadPlayerData(ClientID);
|
Score()->LoadPlayerData(ClientID);
|
||||||
|
|
||||||
SixupNeedsUpdate = true;
|
SixupNeedsUpdate = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(str_comp(Server()->ClientClan(ClientID), pMsg->m_pClan))
|
if(str_comp(Server()->ClientClan(ClientID), pMsg->m_pClan))
|
||||||
|
|
Loading…
Reference in a new issue