Thanks, that new buffer size is great.
However, I still am trying to convert to colour codes instead to maximize use like so:
PHP 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;
}
Format(sName, MAXLENGTH_NAME, " ");
if(g_iTagFlags[iAuthor] & TAG_LOADED && g_iTagFlags[iAuthor] & TAG_SHOWCUSTOM)
{
char sAuthorName[MAX_NAME_LENGTH];
GetClientName(iAuthor, sAuthorName, sizeof(sAuthorName));
Format(sName, MAXLENGTH_NAME, "%s{default}[%s{default}] ", sName, g_sTagFormatString[iAuthor]);
CProcessVariables(sName, MAXLENGTH_NAME);
if(strlen(sName) + 9 + strlen(sAuthorName) > MAXLENGTH_NAME)
{
if(sMessage[0] != '!' && sMessage[0] != '/')
{
RequestFrame(FrameRequestCallback_NameSizeError, iAuthor);
}
return Plugin_Stop;
}
}
switch(GetClientTeam(iAuthor))
{
case 2:
{
Format(sName, MAXLENGTH_NAME, "%s{yellow}%N", sName, iAuthor);
}
case 3:
{
Format(sName, MAXLENGTH_NAME, "%s{blue}%N", sName, iAuthor);
}
default:
{
Format(sName, MAXLENGTH_NAME, "%s{default}%N", sName, iAuthor);
}
}
Format(sMessage, MAXLENGTH_MESSAGE, "{default}%s", sMessage);
CProcessVariables(sName, MAXLENGTH_NAME);
CProcessVariables(sMessage, MAXLENGTH_MESSAGE);
bProcessColours = false;
return Plugin_Changed;
}
I'm checking if their tag is set to be shown and if so:
- Format name with tag prefix
- Convert the colour tags to colour codes (each code max length of 4)
- Check if the length of the name string, author name, plus the addition space required for the name colouring exceeds the buffer size.
I do this same check when setting the tag in-game. But I get some weird results.
https://i.gyazo.com/cf05b1aea49f121d...cebbdc0648.png