pawn Код:
// This callback gets called whenever a player uses the chat-box
public OnPlayerText(playerid, text[])
{
// Setup local variables
new Msg[128], Name[24], SplitText[128];
// Get the player's name
GetPlayerName(playerid, Name, sizeof (Name));
// Check if the entered text is shorter than 70 characters
if (strlen(text) < 70)
{
// Send the message using different colors
format(Msg, 128, "%s: %s", Name, text);
SendClientMessageToAll(0xFFFFFFFF, Msg);
}
else // The entered text is longer, so split it up in 2 parts
{
// Split the text in 2 parts (this is part one)
strmid(SplitText, text, 0, 69);
format(Msg, 128, "%s: %s...", Name, SplitText);
SendClientMessageToAll(0xFFFFFFFF, Msg);
// Split the text in 2 parts (this is part two)
strmid(SplitText, text, 69, 127);
format(Msg, 128, "%s: %s", Name, SplitText);
SendClientMessageToAll(0xFFFFFFFF, Msg);
}
// Don't allow the callback to send the text normally
return 0;
}
Taken directly from my admin-script (un-related code taken out), it uses a similar system and it works.