View Single Post
Mathiaas
Senior Member
Join Date: Aug 2014
Location: Sweden ♥
Old 09-02-2019 , 21:18   Re: [HELP] Set Player's Name Color
Reply With Quote #2

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(intauthorHandle recipientschar[] namechar[] message)
{
    
char file[512];
    
char msg[200];
    
BuildPath(Path_SMfilesizeof(file), "nc.cfg");
    
    
KeyValues kv = new KeyValues("NC");
    
kv.ImportFromFile(file);
    
    
char sid[64];
    
GetClientAuthId(authorAuthId_Steam2sidsizeof(sid));
    if(
KvJumpToKey(kvsid))
    {
        
char color[64];
        
KvGetString(kv"cor"colorsizeof(color));
        
Format(msgsizeof(msg), "%s%s: %s"colornamemessage);
        
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;

Mathiaas is offline