Isn't 128 the maximum length for sent client messages?
#1



The code:

pawn Code:
public OnPlayerText ( playerid, text[] )
{
    new
            Float:      charPos [ 3 ],
                        chatStr [ 128 ],

                        plUserName [ MAX_PLAYER_NAME ];
                       
    GetPlayerPos ( playerid, charPos [ 0 ], charPos [ 1 ], charPos [ 2 ] );
    GetPlayerName ( playerid, plUserName, MAX_PLAYER_NAME );
           
    for( new user; user < MAX_PLAYERS; user ++ )
    {
        if( IsPlayerInRangeOfPoint ( user, 20.0, charPos [ 0 ], charPos [ 1 ], charPos [ 2 ] ) )
        {
            if( GetPlayerVirtualWorld ( user ) == GetPlayerVirtualWorld ( playerid ) )
            {
                format ( chatStr, 128, ""#INT_CHARACTERNAME"%s "#INT_GREY"says: "#INT_WHITE"%s", plUserName, text );
                SendClientMessage ( user, -1, chatStr );
               
                format ( chatStr, 128, ""#INT_GREY"DEBUG: "#INT_WHITE"Character Count: "#INT_CHARACTERNAME"%d", 61 + strlen ( text ) );
                SendClientMessage ( playerid, -1, chatStr );
                return false;
            }
        }
    }
    return 1;
}
61 is the length of the integrated colors and "says:"
Reply
#2

No it's 144 chars but to write in the chat it is 128 chars
Reply
#3

Oh, that makes sense. Thanks!
Reply
#4

Quote:
Originally Posted by 2KY
View Post
Oh, that makes sense. Thanks!
If search sometimes for limit then look there

https://sampwiki.blast.hk/wiki/Limits

PHP Code:
Text I/O     128 cells (512 bytes
And


https://sampwiki.blast.hk/wiki/SendClientMessage

PHP Code:
const message[]    The text you would like to displaymax len displayable144 
Reply
#5

You know why it's 144? It's this:
24 chars (MAX_PLAYER_NAME) + 2 chars (: and a space after it) + 128 (max length chat message) = 144.

Also note that "lol" is cut off at the end in your screenshot, when the string is posted in the chat.
Reply
#6

...minus the color formatting characters makes colored chat texts a little shorter, i figured that out when i placed 8 colors in a chatline, so the text got shorter with each color added.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)