Fix potential issue with team chat. (#524)

This commit is contained in:
shavit 2017-11-15 02:55:03 +02:00
parent db441dd28c
commit ef539c1ac5

View File

@ -369,15 +369,18 @@ public Action CP_OnChatMessage(int &author, ArrayList recipients, char[] flagstr
FormatRandom(message, MAXLENGTH_MESSAGE);
}
#if defined DEBUG
PrintToServer("%N %s", author, flagstring);
#endif
bool allchat = (StrContains(flagstring, "_All") != -1);
int team = GetClientTeam(author);
recipients.Clear();
recipients.Push(author);
for(int i = 1; i <= MaxClients; i++)
{
if(i != author && IsClientInGame(i) && (allchat || GetClientTeam(i) == team))
if(i == author || (IsClientInGame(i) && (allchat || GetClientTeam(i) == team)))
{
recipients.Push(i);
}