PHP Code:
char sArg[MAX_UNPROCESSED_LENGTH];
GetCmdArgString(sArg, sizeof(sArg));
char sTemp[MAX_UNPROCESSED_LENGTH];
Format(sTemp, sizeof(sTemp), sArg);
CProcessVariables(sTemp, sizeof(sTemp));
PrintToChat(iClient, "Size: %d", strlen(sTemp));
PrintToConsole(iClient, "String: %s", sTemp);
// MAX_UNPROCESSED_LENGTH = 128
// MAX_FORMAT_LENGTH = 64
// MAX_TAG_LENGTH = 16
// {blue}H{red}e{orchid}y{blue}H{red}e{orchid}y{blue}H{red}e{orchid}y{blue}H{red}e{orchid}y{blue}H{red}e{orchid}y{blue}Hey Length: 119
// 0x24H0x34e0x35y0x24H0x34e0x35y0x24H0x34e0x35y0x24H0x34e0x35y0x24H0x34e0x35y0x24Hey Length: 82 (Printed Length = 34) ??
if(strlen(sTemp) > MAX_FORMAT_LENGTH)
{
ReplyToCommand(iClient, "[%s] Error, entered tag format exceeds character limit. (Including colour tags)", PREFIX);
return Plugin_Handled;
}
if(GetFormatTrueLength(sArg, sizeof(sArg)) > MAX_TAG_LENGTH)
{
ReplyToCommand(iClient, "[%s] Error, entered tag format exceeds character limit. (Excluding colour tags)", PREFIX);
return Plugin_Handled;
}
I'm checking if the format, when processed, exceeds a limit. And if when colours are removed, it exceeds the visible character limit (To keep chat legible).
Why is the printed length 34 when it exceeds the limit specified?
EDIT: I know those codes aren't right, I just know they can be 4 chars long