Isn't 128 the maximum length for sent client messages? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Isn't 128 the maximum length for sent client messages? (
/showthread.php?tid=404352)
Isn't 128 the maximum length for sent client messages? -
2KY - 02.01.2013
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:"
AW: Isn't 128 the maximum length for sent client messages? -
IPrototypeI - 02.01.2013
No it's 144 chars but to write in the chat it is 128 chars
Re: Isn't 128 the maximum length for sent client messages? -
2KY - 02.01.2013
Oh, that makes sense. Thanks!
AW: Re: Isn't 128 the maximum length for sent client messages? -
IPrototypeI - 02.01.2013
Quote:
Originally Posted by 2KY
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 display. max len displayable: 144
Re: Isn't 128 the maximum length for sent client messages? -
Basssiiie - 02.01.2013
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.
Re: Isn't 128 the maximum length for sent client messages? -
Babul - 03.01.2013
...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.