Posts: 1,266
Threads: 6
Joined: Oct 2014
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?