19.05.2015, 23:45
Older function of mine, taken from my Sublimity RP V2 gamemode. Should work though. What it does is split strings in half instead of cutting them off.
EDIT: I added a "type" parameter because I didn't want to use two seperate functions to split strings (or use loops), as I was also using this for global OOC chats. You don't need it.
Picture: http://i.imgur.com/rneBBEL.png
pawn Код:
ReturnSplittedMessage(playerid, senderid, color, text[], type)
{
if(strlen(text) <= 70) SendClientMessage(playerid, color, text);
else if(strlen(text) > 70)
{
// Was "105" before, change back if shit fucks up
if(strlen(text) > 144)
return SendClientMessage(senderid, COLOR_ERROR, "[ERROR]:{E0E0E0} Message format request can't be completed because the string exceeds the limit!");
new texts[74];
strmid(texts, text, 70, 144);
strdel(text, 70, 144);
// Following causes strins error and fucks the function up:
// strins(text, " ..", 70, 3);
// printf("START %s END", text);
if(type == 1) // Local
{
SendClientMessage(playerid, color, text);
SendClientMessage(playerid, color, texts);
}
else if(type == 2) // Global
{
SendClientMessageToAll(color, text);
SendClientMessageToAll(color, texts);
}
}
return true;
}
Picture: http://i.imgur.com/rneBBEL.png