Format the name do have the name before the tag inside of the name string.
This is my code for a tag plugin I made, so take from it what you will:
Code:
public Action CP_OnChatMessage(int& iAuthor, ArrayList hRecipients, char[] sFlagString, char[] sName, char[] sMessage, bool& bProcessColours, bool& bRemoveColours)
{
if(!IsValidClient(iAuthor))
{
return Plugin_Continue;
}
bProcessColours = false;
char sNameBuffer[MAXLENGTH_MESSAGE * 2];
Format(sNameBuffer, sizeof(sNameBuffer), " ");
if(g_bWarden)
{
if(JailbreakWarden_IsWarden(iAuthor))
{
Format(sNameBuffer, sizeof(sNameBuffer), "%s{default}[{darkblue}W{default}] ", sNameBuffer);
}
}
if(g_iTagFlags[iAuthor] & TAG_LOADED && !(g_iTagFlags[iAuthor] & TAG_HIDECUSTOM))
{
Format(sNameBuffer, sizeof(sNameBuffer), "%s{default}[%s{default}] ", sNameBuffer, g_sTagFormatString[iAuthor]);
}
switch(GetClientTeam(iAuthor))
{
case 0, 1:
{
char sRawName[MAX_NAME_LENGTH];
GetClientName(iAuthor, sRawName, sizeof sRawName);
CRemoveColors(sRawName, MAX_NAME_LENGTH);
RemoveColourCodes(sRawName, MAX_NAME_LENGTH);
Format(sNameBuffer, sizeof(sNameBuffer), "%s{default}%s", sNameBuffer, sRawName);
}
default:
{
char sRawName[MAX_NAME_LENGTH];
GetClientName(iAuthor, sRawName, sizeof sRawName);
CRemoveColors(sRawName, MAX_NAME_LENGTH);
RemoveColourCodes(sRawName, MAX_NAME_LENGTH);
Format(sNameBuffer, sizeof(sNameBuffer), "%s{teamcolor}%s", sNameBuffer, sRawName);
}
}
CRemoveColors(sMessage, MAXLENGTH_MESSAGE);
RemoveColourCodes(sMessage, MAXLENGTH_MESSAGE);
Format(sMessage, MAXLENGTH_MESSAGE, "{default}%s", sMessage);
CProcessVariables(sNameBuffer, sizeof(sNameBuffer));
CProcessVariables(sMessage, MAXLENGTH_MESSAGE);
Format(sName, MAXLENGTH_NAME, sNameBuffer);
return Plugin_Changed;
}
I'm using chat processor plugin.