Split string
#1

If the text is over SA:MP limit then it splits string. Ex.

Код:
SendSplittedMessage(playerid, -1, "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit means there is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain!");
So it should look like:

Код:
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...
...means there is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain!
So it send 2 lines to player so I can increase the size of the string.

I need help with this
Reply
#2

Just make 2 strings and send String #1 and then String #2
Reply
#3

That's what I created for my GM, works as a charm:
pawn Код:
stock SendSplittedMessage(playerid, color, txt[])
{
    new len = strlen(txt), txt2[128];
    if(len > 99)
    {
        for(new i = 100; i != len; i++)
        {
            if(i > 120) break;
            if(txt[i] == ' ')
            {
                strmid(txt2, txt, i + 1, len, sizeof(txt2));
                strdel(txt, i, len);
                strins(txt2, "...", 0, 128);
                strins(txt, "...", i, 128);
                print(txt); print(txt2);
                SendClientMessage(playerid, color, txt);
                SendClientMessage(playerid, color, txt2);
                return 1;
            }
        }
        strmid(txt2, txt, 120, len, sizeof(txt2));
        strdel(txt, 120, strlen(txt));
        strins(txt2, "-", 0, 128);
        strins(txt, "-", strlen(txt), 128);
        print(txt); print(txt2);
        SendClientMessage(playerid, color, txt);
        SendClientMessage(playerid, color, txt2);
    }
    else SendClientMessage(playerid, color, txt), print(txt);
    return 1;
}
Edit: You can remove the prints if you want.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)