Making the chat and the message split? -
JaKe Elite - 29.11.2012
Is it possible to split up the chat??
Like if i've 120 lengths in my word it will automatically do like
Code:
I love Chicken I ha-
te McDonalds
I've one but it shows the name like
Code:
* Romel Rowan junking in the yard for 3 mon-
* Romel Rowan ths
Here is the code
pawn Code:
if(IsPlayerInRangeOfPoint(i, radi, x, y, z))
{
if(strlen(string) <= 120) SendClientMessage(i, color, string);
else
{
new texts[120];
strmid(texts, string, 120, 129);
strins(string, "-", 120, 1);
strdel(string, 121, 129);
SendClientMessage(i, color, string);
SendClientMessage(i, color, string);
}
}
Re: Making the chat and the message split? -
Boooth - 29.11.2012
Can you show me your OnPlayerCommandText.
Re: Making the chat and the message split? -
JaKe Elite - 29.11.2012
I'm not using OnPlayerCommandText
Re: Making the chat and the message split? -
GiamPy. - 29.11.2012
pawn Code:
stock SendPlayerExtendedMessage(playerid, color, const string[])
{
new firstString[128],
secondString[128],
finalStringLINE1[128],
finalStringLINE2[128];
if(strlen(string) > 70) // here you can choose the lenght of the first string
{
format(firstString, sizeof(firstString), string);
format(secondString, sizeof(secondString), string);
strdel(firstString, 70, 140);
strdel(secondString, 0, 70);
format(finalStringLINE1, sizeof(finalStringLINE1), "%s ...", firstString);
SendClientMessage(playerid, color, finalStringLINE1);
format(finalStringLINE2, sizeof(finalStringLINE2), "... %s", secondString);
SendClientMessage(playerid, color, finalStringLINE2);
return true;
}
else
{
SendClientMessage(playerid, color, string);
return true;
}
}
Re: Making the chat and the message split? -
[MM]RoXoR[FS] - 29.11.2012
Try this
UNTESTED
pawn Code:
if(IsPlayerInRangeOfPoint(i, radi, x, y, z))
{
new j=0;
new temp[121];
for(;string[j]!='\0';)
{
for(new i=0;i<=119 && string[j]!='\0';++i)
{
temp[i]=string[j];
++j;
}
temp[120]='-';
SendClientMessage(i, color,temp);
}
}
Re: Making the chat and the message split? -
JaKe Elite - 30.11.2012
I will try later. I'm in mobile.
Re: Making the chat and the message split? -
JaKe Elite - 30.11.2012
RoXor it works but it fails to split up.
I type random words at the end i type.
but it shows
Re: Making the chat and the message split? -
cosbraa - 30.11.2012
pawn Code:
stock strsplit(source[], first[], second[], split_pos)
{
strmid(source, first, 0, split_pos);
strins(first, "-", split_pos);
strmid(source, second, split_pos, strlen(source));
return 1;
}
I had something like this, don't have access to it right now.
Might have to play around with it, but it worked for me.
Re: Making the chat and the message split? -
JaKe Elite - 30.11.2012
How could i use it.?
Re: Making the chat and the message split? -
cosbraa - 30.11.2012
pawn Code:
CMD:me(playerid, params[])
{
new line1[128], line2[128], string[128];
if(strlen(params) > 120)
{
// "* 012345678901234567890123 " = 27 characters. 128 - 27 = 101
strsplit(params, line1, line2, 101);
format(string, sizeof(string), "* %s %s", GetNameEx(playerid), line1);
NearByMessage(playerid, COLOUR, string);
format(string, sizeof(string), "* %s ((%s)), line2, GetNameEx(playerid));
NearByMessage(playerid, COLOUR, string);
}
else
{
format(string, sizeof(string), "* %s %s", GetNameEx(playerid), params);
NearByMessage(playerid, COLOUR, string);
}
return 1;
}
that kind of way. on ipod, may have mistakes.