String too big = no text
#1

I seen on some servers a fix to this:

e.g. /ad Selling my Bravura for only 56k, Brand new, null dents...
... SMS me with your offers. Blablablabla


I aint sure how to split this ad in two pieces if it is too long.
I guess using strlen and maybe split ?
Reply
#2

You can use this function.

pawn Код:
SendSplittedMessage(playerid, color, const msg[], maxlen)
{
    new firstpos, lastpos;
    new part[128];
    new count = 1;
    new length = strlen(msg);
    for(new p=0; p < length; p++)
    {
        if(msg[p] == ' ')
        {
            lastpos = p;
        }
        if(p == length-1)
        {
            lastpos = length;
        }
        if(p >= count*maxlen || p == length-1)
        {
            if(lastpos == firstpos) { lastpos = count*maxlen; }
            strmid(part, msg, firstpos, lastpos, 128);
            firstpos = lastpos;
            count++;
            SendClientMessage(playerid, color, part);
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)