Splitting messages... -
Scenario - 11.12.2011
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...
Re: Splitting messages... -
Ballu Miaa - 11.12.2011
Which function your using for the Message? SendClientMessage();? Or a Custom one?
Re: Splitting messages... -
THE_KNOWN - 11.12.2011
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
Re: Splitting messages... -
Scenario - 11.12.2011
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?
Re: Splitting messages... -
GAMER_PS2 - 11.12.2011
hmmm i seen this in RP Servers before try to check RP Scripts
Re: Splitting messages... -
Ballu Miaa - 11.12.2011
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.
Re: Splitting messages... -
THE_KNOWN - 11.12.2011
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
Re: Splitting messages... -
Scenario - 11.12.2011
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.
Re: Splitting messages... -
Scenario - 11.12.2011
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!
Re: Splitting messages... -
Ballu Miaa - 11.12.2011
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