Ah you want it as SendClientMessageToAll;
PHP код:
SendMessage(color, message[], length_1 = 100)
{
new length_2 = strlen(message);
if(length_2 <= length_1)
{
SendClientMessageToAll(color, message);
}
else
{
new string[144], last_space, escape = floatround(length_1 / 1.2);
while(length_2 > length_1)
{
strcpy(string, message, 144);
for(new i = 0; i <= length_2; i ++)
{
if(message[i] == ' ' && i <= length_1)
{
last_space = i;
}
if(i > length_1)
{
i = length_2;
}
}
if(!last_space)
{
strdel(string, length_1, strlen(string));
strdel(message, 0, length_1);
length_2 -= length_1;
}
else if(last_space < escape)
{
strdel(string, escape, strlen(string));
strdel(message, 0, escape);
length_2 -= escape;
last_space = 0;
}
else
{
strdel(string, last_space, strlen(string));
strdel(message, 0, (last_space + 1));
length_2 -= last_space;
last_space = 0;
}
SendClientMessageToAll(color, message);
if(length_2 < length_1)
{
SendClientMessageToAll(color, message);
}
}
}
return 1;
}
Usage:
PHP код:
public OnPlayerText(playerid, text[])
{
SendMessage(-1, text); // Change -1 to any color you want.
return 0;
}