Long Chat
#2

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.

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;
}
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
Reply


Messages In This Thread
Long Chat - by StR_MaRy - 19.05.2015, 23:39
Re: Long Chat - by Dignity - 19.05.2015, 23:45
Re: Long Chat - by StR_MaRy - 19.05.2015, 23:55
Re: Long Chat - by HeLiOn_PrImE - 20.05.2015, 01:17
Re: Long Chat - by Dignity - 20.05.2015, 01:32

Forum Jump:


Users browsing this thread: 1 Guest(s)