Quote:
Originally Posted by Mathiaas
Quickly reading through your code, it's not like your OnChatMessage callback does anything? Sure you format the "name" string but that's not what's being sent out to the clients as the message.
You will probably have to stop your message from going out and send your own, customized one. It's 03 in the morning and tired af, but try this one:
PHP Code:
public Action OnChatMessage(int& author, Handle recipients, char[] name, char[] message)
{
char file[512];
char msg[200];
BuildPath(Path_SM, file, sizeof(file), "nc.cfg");
KeyValues kv = new KeyValues("NC");
kv.ImportFromFile(file);
char sid[64];
GetClientAuthId(author, AuthId_Steam2, sid, sizeof(sid));
if(KvJumpToKey(kv, sid))
{
char color[64];
KvGetString(kv, "cor", color, sizeof(color));
Format(msg, sizeof(msg), "%s%s: %s", color, name, message);
PrintToChatAll(msg); // Change this into "SayText2" if you want the teamcolors in case you want teamchat etc. https://forums.alliedmods.net/showthread.php?t=206539
return Plugin_Handled;
}
return Plugin_Continue;
}
|
OnChatMessage comes from the scp include or a similar chat-processor.
There are several things wrong with this code, especially the reading the keyvalue from file everytime some one types in chat.
There are a ton of custom chat color plugins already out there try using those as examples and write your code off of that.