SA-MP Forums Archive
About strings - 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: About strings (/showthread.php?tid=453740)



About strings - Zex Tan - 26.07.2013

I was wondering how to edit strings such as

Quote:

Player A: Le anonymous is talking right ...
here

Something like, when the string text is too long it will continue to the bottom after the word "right".


Re: About strings - Threshold - 26.07.2013

I won't copy anyone else's code, so I'm going to quote what I found using the SEARCH button.

Quote:
Originally Posted by Extremo
Посмотреть сообщение
pawn Код:
// Define when to split the text into another line!
#define EX_SPLITLENGTH 118

stock SendSplitMessage(playerid, color, final[])
{
    new buffer[EX_SPLITLENGTH+5];
    new len = strlen(final);
    if(len>EX_SPLITLENGTH)
    {
        new times = (len/EX_SPLITLENGTH);
        for(new i = 0; i < times+1; i++)
        {
            strdel(buffer, 0, EX_SPLITLENGTH+5);
            if(len-(i*EX_SPLITLENGTH)>EX_SPLITLENGTH)
            {
                strmid(buffer, final, EX_SPLITLENGTH*i, EX_SPLITLENGTH*(i+1));
                format(buffer, sizeof(buffer), "%s ...", buffer);
            }
            else
            {
                strmid(buffer, final, EX_SPLITLENGTH*i, len);
            }
            SendClientMessage(playerid, color, buffer);
        }
    }
    else
    {
        SendClientMessage(playerid, color, final);
    }
}
Usage:

pawn Код:
SendSplitMessage(playerid, color, msg);
EDIT:

The above code is just more or less an example and may or may not be really fast processing your strings. Your probably better off using split.