03.09.2018, 17:30
I have a problem with this stock:
OnPlayerText:
If i type, ex: test test test test test test test test test test test test test test test test test test test test (more than 150 chars), it sends just the last 3 words of the text, without playernick/color, why?
pawn Код:
#define EX_SPLITLENGTH 150
stock SendSplitMessageToAll(color, const 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);
}
SCMTA(color, buffer);
}
}
else
{
SCMTA(color, final);
}
return 1;
}
pawn Код:
new j[230];
format(j,sizeof j,"{%06x} %s: "WHITE"%s ", GetPlayerColor(playerid) >>> 8, ReturnName(playerid, 0), text);
SendSplitMessageToAll(-1, j);