How can I send very long messages?
#5

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?
Reply


Messages In This Thread
How can I send very long messages? - by danielpalade - 28.02.2017, 23:39
Re: How can I send very long messages? - by StrikerZ - 01.03.2017, 01:19
Re: How can I send very long messages? - by danielpalade - 01.03.2017, 02:11
Re: How can I send very long messages? - by Dignity - 01.03.2017, 02:57
Re: How can I send very long messages? - by jlalt - 01.03.2017, 03:45
Re: How can I send very long messages? - by Vince - 01.03.2017, 05:34
Re: How can I send very long messages? - by Dignity - 01.03.2017, 17:01

Forum Jump:


Users browsing this thread: 1 Guest(s)