#8

I wrote this for my GM:

pawn Код:
stock real_SendClientMessage(playerid, COLOR, string[], size = sizeof(string))
{
    new
        szString2[128],
        bool:iSplit;
       
    if(strlen(string) > 128)
    {
        new
            szLastHexColor[9],
            iStartPosition;
           
        while((iStartPosition = strfind(string, "{", true, iStartPosition)) != -1)
        {
            strmid(szLastHexColor, string, iStartPosition, iStartPosition+8);
            iStartPosition += 8;
        }
       
        strmid(szString2, string, 128, 256);
        strdel(string, 128, 256);
        strcat(string, " ..", size);
        strins(szString2, " .. ", 0);
        if(!isnull(szLastHexColor)) strins(szString2, szLastHexColor, 0);
        iSplit = true;
    }
       
    if(iSplit) SendClientMessage(playerid, COLOR, string), SendClientMessage(playerid, COLOR, szString2);
    else SendClientMessage(playerid, COLOR, string);
    return 1;
}
It also tries to take into account the possibility of HEX colors being embedded into the string. I noticed that it would cut the string in bad places (i.e. in the middle of a HEX color code) and would screw it all up. The function works like a charm though!
Reply


Messages In This Thread
Chat - by Mattakil - 22.02.2014, 21:52
Re: Chat - by Mattakil - 25.02.2014, 01:55
Re: Chat - by Kapupc - 25.02.2014, 02:03
Re: Chat - by Kapupc - 25.02.2014, 02:14
Re: Chat - by Mattakil - 25.02.2014, 02:20
Re: Chat - by Kapupc - 25.02.2014, 02:21
Re: Chat - by Kapupc - 25.02.2014, 02:27
Re: Chat - by Scenario - 25.02.2014, 03:55
Re: Chat - by Mattakil - 25.02.2014, 04:06

Forum Jump:


Users browsing this thread: 1 Guest(s)