How can I send very long messages? -
danielpalade - 28.02.2017
-- DELETED --
Re: How can I send very long messages? -
StrikerZ - 01.03.2017
That's called splitting, check
http://forum.sa-mp.com/showpost.php?...26&postcount=3
Re: How can I send very long messages? -
danielpalade - 01.03.2017
Quote:
Originally Posted by Sunehildeep
|
Yea but the thing is, it won't display a message as long as in that picture..
Re: How can I send very long messages? -
Dignity - 01.03.2017
You need to process the text, check for length and then split it accordingly.
Here's an outdated version of the function I used. It works, but you need to format text and then use this function to send the message (in order to support text splitting).
You can use up the entire chat bar (until it won't let you go further) and it will parse all of the text.
pawn Код:
SendCompressedMessage ( reciever, col, text [] ) {
new compressedText [ 256 ];
format ( compressedText, sizeof( compressedText), "%s", text);
if ( strlen ( compressedText ) > 75 ) {
new cutText [ 120 ];
strmid(cutText, compressedText, 0, 74);
strdel(compressedText, 0, 74);
strins(cutText, " ...", strlen ( cutText)) ;
strins(compressedText, "... ", 0) ;
SendClientMessage ( reciever, col, cutText);
SendClientMessage ( reciever, col, compressedText);
}
else SendClientMessage ( reciever, col, text );
return true ;
}
Example:
pawn Код:
CMD:me ( playerid, params [] ) {
static text [ 144 ], string [ 256 ];
if ( sscanf ( params, "s[144]", text ) ) {
return SendClientMessage(playerid, 0x11A5D6FF, "* Syntax:{dedede} /me [text]");
}
format ( string, sizeof ( string ), "* %s %s",ReturnUserName ( playerid, false ), text );
SendCompressedMessage ( playerid, CHAT_COLOUR_ACTION, string );
return true;
}
Re: How can I send very long messages? -
jlalt - 01.03.2017
Quote:
Originally Posted by Dignity
You need to process the text, check for length and then split it accordingly.
Here's an outdated version of the function I used. It works, but you need to format text and then use this function to send the message (in order to support text splitting).
You can use up the entire chat bar (until it won't let you go further) and it will parse all of the text.
pawn Код:
SendCompressedMessage ( reciever, col, text [] ) {
new compressedText [ 256 ];
format ( compressedText, sizeof( compressedText), "%s", text);
if ( strlen ( compressedText ) > 75 ) { new cutText [ 120 ];
strmid(cutText, compressedText, 0, 74); strdel(compressedText, 0, 74);
strins(cutText, " ...", strlen ( cutText)) ; strins(compressedText, "... ", 0) ;
SendClientMessage ( reciever, col, cutText); SendClientMessage ( reciever, col, compressedText); }
else SendClientMessage ( reciever, col, text );
return true ; }
Example:
pawn Код:
CMD:me ( playerid, params [] ) {
static text [ 144 ], string [ 256 ];
if ( sscanf ( params, "s[144]", text ) ) { return SendClientMessage(playerid, 0x11A5D6FF, "* Syntax:{dedede} /me [text]"); }
format ( string, sizeof ( string ), "* %s %s",ReturnUserName ( playerid, false ), text ); SendCompressedMessage ( playerid, CHAT_COLOUR_ACTION, string );
return true; }
|
Why you're using static chars O_O?
Also did you know "ReturnUserName" doesn't exist in samp xd?
Re: How can I send very long messages? -
Vince - 01.03.2017
Quote:
Originally Posted by danielpalade
Yea but the thing is, it won't display a message as long as in that picture..
|
Each embedded colors lowers the total amount of available characters by 8. The message in that picture is all white and as such can use the full available length.
Re: How can I send very long messages? -
Dignity - 01.03.2017
Quote:
Originally Posted by jlalt
Why you're using static chars O_O?
Also did you know "ReturnUserName" doesn't exist in samp xd?
|
Like I said, it's old deprecated code of mine lmfao. Either way, that's just a function that returns the name.