Fix emotes sometimes being shown for others tees

The `Translate` function modifies the first argument, so the client ID keeps changing when the function is being used in a loop. Additionally, calling `Translate` manually is not necessary for messages, as client IDs in messages are already automatically translated when using `SendPackMsg`. Both faults can cause emoticons to appear on the wrong players when the emote spamprotection limits emotes to nearby players.
This commit is contained in:
Robert Müller 2023-08-05 15:54:04 +02:00
parent 8fc5549306
commit 92dc3d4a0f

View file

@ -2541,8 +2541,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
{ {
for(int i = 0; i < MAX_CLIENTS; ++i) for(int i = 0; i < MAX_CLIENTS; ++i)
{ {
if(Server()->Translate(ClientID, i) && if(m_apPlayers[i] && pChr->CanSnapCharacter(i) && pChr->IsSnappingCharacterInView(i))
m_apPlayers[i] && pChr->CanSnapCharacter(i) && pChr->IsSnappingCharacterInView(i))
{ {
SendEmoticon(ClientID, pMsg->m_Emoticon, i); SendEmoticon(ClientID, pMsg->m_Emoticon, i);
} }