Quote:
Originally Posted by MAGNAT2645
thanks, duplication fixed but there problem with ColorVariables (with Custom Chat Colors):
Player's name colored with lightgreen but not teamcolor.
And it seems that message length sometimes does not fit
|
Yes, this is a problem I had when I was working on a "Chat Processor: Tags" plugin that utilized ColorVariables. The fix for that issue was to get the client's team before the message or something. Let me check my code and see if I can find the fix snippet.
EDIT: Found it. The fix was to use "CSetNextAuthor", in a way similar to this:
PHP Code:
for (int i = 0; i < GetArraySize(hRecipients); i++)
{
int client = GetArrayCell(hRecipients, i);
if (IsClientInGame(client))
{
CSetNextAuthor(client);
CPrintToChat(client, "%s: %s", strNewName, strNewMessage);
}
}
Of course, don't actually do what I did because there's a whole load of issues that arise with trying to use PrintToChat/CPrintToChat within OnChatMessage or OnChatMessagePost..I think. Most should be fixed now actually, such as the message duplication glitch....but basically just toss a CSetNextAuthor(whatever); before wherever you're sending your message. But you actually probably could do what I did now...
starting to think I should take a look at that chat processor: tags plugin I abandoned and see if I can get it functional and working properly and have nice EngineVersion support...
Without using CSetNextAuthor, ColorVariables' "\x03" code reverts to it's normal standard color (light green). The only reason \x03 is even used as teamcolor is because Colors/MoreColors (I forget which) actually had a check within that would force the change of \x03's color from lightgreen to teamcolored if it detected the usage of "{teamcolor}" in a string. Without Colors/MoreColors, I believe \x03 would not have any teamcoloring functionality provided to it by the engine, and it would just be lightgreen.