Thread: [Solved] Chat Processor Limitations
View Single Post
Michael Shoe Maker
Senior Member
Join Date: Apr 2016
Old 02-04-2017 , 16:55   Re: Chat Processor Limitations
Reply With Quote #13

PHP Code:
char sArg[MAX_UNPROCESSED_LENGTH];
        
GetCmdArgString(sArgsizeof(sArg));
        
        
char sTemp[MAX_UNPROCESSED_LENGTH];
        
Format(sTempsizeof(sTemp), sArg);
        
CProcessVariables(sTempsizeof(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(sArgsizeof(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

Last edited by Michael Shoe Maker; 02-04-2017 at 16:57.
Michael Shoe Maker is offline