Splitting messages...
#1

If you've ever played LS:RP before, you probably noticed that if your message was too long, it was automatically broken up into different lines. I know how annoying it can be when you create this super-long message and press enter, only to find out that the message was cut off in the middle of the whole thing.

I haven't ever understood how I would be able to split the message into as many lines as necessary until the message is able to be sent without it being cut off. I believe 128 characters can be on a single line in SA-MP, therefore if it could split the message after ever 100 characters (only if it's over 128 in the first place), then it would be great!

Could anyone assist me in doing this? Or even make it easier and post your code if you've done this before...
Reply
#2

Which function your using for the Message? SendClientMessage();? Or a Custom one?
Reply
#3

i dont know but maybe you could use:

pawn Код:
stock splitstring(actualstring,&split1[],&split2[])
{
    if(sizeof(actualstring) > 100)
    {
        new rlen = sizeof(actualstring) - 100, str[rlen];
        format(split1,100,"%s",actualstring);
        for(new i;i<rlen;i++)
        {
            split2[i]=actualstring[99+i];
        }
    }
    return 1;
}
untested.

split1 string will contain first 100 chars and the split2 string will be fed with chars starting from 100th from actualstring
Reply
#4

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
Which function your using for the Message? SendClientMessage();? Or a Custom one?
It would be for multiple different things, for example IC/OOC chat, PM's, etc... I'll change the function if necessary, I'm just looking for a way to get the splitting done. However, to answer your question, SendClientMessage().


Quote:
Originally Posted by THE_KNOWN
Посмотреть сообщение
i dont know but maybe you could use:

pawn Код:
stock splitstring(actualstring,&split1[],&split2[])
{
    if(sizeof(actualstring) > 100)
    {
        new rlen = sizeof(actualstring) - 100, str[rlen];
        format(split1,100,"%s",actualstring);
        for(new i;i<rlen;i++)
        {
            split2[i]=actualstring[99+i];
        }
    }
    return 1;
}
untested.

split1 string will contain first 100 chars and the split2 string will be fed with chars starting from 100th from actualstring
That will only allow me to send a 200 character message. I'm looking for a way to have it split as many times as it needs to automatically. I've seen systems where the line can split up to 5 times, but what if I send a longer message?
Reply
#5

hmmm i seen this in RP Servers before try to check RP Scripts
Reply
#6

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
It would be for multiple different things, for example IC/OOC chat, PM's, etc... I'll change the function if necessary, I'm just looking for a way to get the splitting done. However, to answer your question, SendClientMessage().




That will only allow me to send a 200 character message. I'm looking for a way to have it split as many times as it needs to automatically. I've seen systems where the line can split up to 5 times, but what if I send a longer message?
You can use the code THE_KNOWN Has posted. Customize it for 5 Splitting lines. You wont require more then that as noone is that stupid that he/she will keep on typing in the same Line.
Reply
#7

well im not experienced enough as you are but its just an outline what i gave. maybe you can use the func's in core.inc (numargs,getargs and all) to split?

BTW: isnt the max input in dialogs and chat 128 too?:S
Reply
#8

Quote:
Originally Posted by GAMER_PS2
Посмотреть сообщение
hmmm i seen this in RP Servers before try to check RP Scripts
I can assure you that such a function doesn't exist in any of the released modes.
Reply
#9

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
You can use the code THE_KNOWN Has posted. Customize it for 5 Splitting lines. You wont require more then that as noone is that stupid that he/she will keep on typing in the same Line.
Good point. Thanks y'all!
Reply
#10

All good brother! Happy to help. Can you please help me with my Problem as well??

This is the thread : http://forum.sa-mp.com/showthread.ph...55#post1564955
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)