19.07.2011, 23:14
I realize the original poster has some sort of a bigger issue on his hands with OnPlayerText callback, but a tip about the code that Shadoww5 posted...
If you want to split the text into two lines (move one part of the message to the next line) it would be nice if you actually looked for a space to split from!
I suppose the example is a little rough and I might of have messed something up somewhere (hey! it is 2am!) but it makes a good theory.
The next step would be displaying the lines if necessary!
Of course return false in the end. You could probably add some color formatting like
If you want to split the text into two lines (move one part of the message to the next line) it would be nice if you actually looked for a space to split from!
pawn Код:
new space = -1, nextline[64];
if(strlen(text) > 80)
{
space = strfind(text, " ", false, 60);
if(space == -1 || space > 80) space = 70;
strmid(nextline, text, space, strlen(text));
strdel(text, space, strlen(text));
}
The next step would be displaying the lines if necessary!
pawn Код:
new str[128], PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(str, sizeof(str), "%s(%i): %s", PlayerName, playerid, text);
SendClientMessageToAll(COLOR, str);
if(space != -1)
SendClientMessageToAll(COLOR, nextline);
pawn Код:
format(str, sizeof(str), "%06x%s(%i){FFFFFF}: %s", GetPlayerColor(playerid) >>> 8, PlayerName, playerid, text);