How can I send very long messages?
#1

-- DELETED --
Reply
#2

That's called splitting, check http://forum.sa-mp.com/showpost.php?...26&postcount=3
Reply
#3

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
Yea but the thing is, it won't display a message as long as in that picture..
Reply
#4

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;
}
Reply
#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
#6

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.
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)