10.06.2012, 20:58
Well.. I Was wondering how to make that once the player type something in the chat and it's too long for one line - the chat continue in the second line - hope to get help
// Define when to split the text into another line!
#define EX_SPLITLENGTH 118
stock SendSplitMessage(playerid, color, final[])
{
new buffer[EX_SPLITLENGTH+5];
new len = strlen(final);
if(len>EX_SPLITLENGTH)
{
new times = (len/EX_SPLITLENGTH);
for(new i = 0; i < times+1; i++)
{
strdel(buffer, 0, EX_SPLITLENGTH+5);
if(len-(i*EX_SPLITLENGTH)>EX_SPLITLENGTH)
{
strmid(buffer, final, EX_SPLITLENGTH*i, EX_SPLITLENGTH*(i+1));
format(buffer, sizeof(buffer), "%s ...", buffer);
}
else
{
strmid(buffer, final, EX_SPLITLENGTH*i, len);
}
SendClientMessage(playerid, color, buffer);
}
}
else
{
SendClientMessage(playerid, color, final);
}
}
SendSplitMessage(playerid, color, msg);
pawn Code:
pawn Code:
|
if(realchat)
{
if(gPlayerLogged[playerid] == 0)
{
return 0;
}
else if(PlayerInfo[playerid][pMask] == 1)
{
if(strcmp(Accent[playerid],"none",true,3))
{
format(string, sizeof(string), "Stranger says: [%s Accent] %s",Accent[playerid],text);
}
else
{
format(string, sizeof(string), "Stranger says: %s",text);
}
}
else
{
if(strcmp(Accent[playerid],"none",true,3))
{
format(string, sizeof(string), "%s says: [%s Accent] %s",RemoveUnderScore(playerid),Accent[playerid],text);
}
else
{
format(string, sizeof(string), "%s says: %s",RemoveUnderScore(playerid),text);
}
}
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
return 0;
}
return 1;
}
[09:19:54] This is a pretty long test string to see how fast this thing will actually split the string. Let's see how well it wor ... [09:19:54] ks with this shall we?