SA-MP Forums Archive
Help me with main chat! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help me with main chat! (/showthread.php?tid=428620)



Help me with main chat! - BodyBoardVEVO - 06.04.2013




How i can go to other line, i dont want so long text on 1 line


Re: Help me with main chat! - Stealthy - 06.04.2013

https://sampforum.blast.hk/showthread.php?tid=350008 Check that out.


Re: Help me with main chat! - Kenrque - 06.04.2013

Quote:

#include <a_samp>

#define EX_SPLITLENGTH 118

stock SendSplitMessage(playerid, color, final[])
{
#pragma unused playerid, color
new buffer[EX_SPLITLENGTH+5];
new len = strlen(final);
if(len>EX_SPLITLENGTH)
{
new times = (len/EX_SPLITLENGTH);
for(new i = 0; i < times+1; i++)
{
strdel(buffer, 0, EX_SPLITLENGTH+5);
if(len-(i*EX_SPLITLENGTH)>EX_SPLITLENGTH)
{
strmid(buffer, final, EX_SPLITLENGTH*i, EX_SPLITLENGTH*(i+1));
format(buffer, sizeof(buffer), "%s ...", buffer);
}
else
{
strmid(buffer, final, EX_SPLITLENGTH*i, len);
}
//SendClientMessage(playerid, color, buffer);
}
}
else
{
//SendClientMessage(playerid, color, final);
}
}

main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");

new time = GetTickCount();
for(new i = 0; i < 1000; i++)
{
SendSplitMessage(0, 0, "This is a pretty long test string to see how fast this thing will actually split the string. Let's see how well it works with this shall we?");
}
printf("Time: %d", GetTickCount()-time);
}

or
Код:
SendSplitMessage(playerid, color, msg); // and
// Define when to split the text into another line!
#define EX_SPLITLENGTH 118

stock SendSplitMessage(playerid, color, final[])
{
    new buffer[EX_SPLITLENGTH+5];
    new len = strlen(final);
    if(len>EX_SPLITLENGTH)
    {
        new times = (len/EX_SPLITLENGTH);
        for(new i = 0; i < times+1; i++)
        {
            strdel(buffer, 0, EX_SPLITLENGTH+5);
            if(len-(i*EX_SPLITLENGTH)>EX_SPLITLENGTH)
            {
                strmid(buffer, final, EX_SPLITLENGTH*i, EX_SPLITLENGTH*(i+1));
                format(buffer, sizeof(buffer), "%s ...", buffer);
            }
            else
            {
                strmid(buffer, final, EX_SPLITLENGTH*i, len);
            }
            SendClientMessage(playerid, color, buffer);
        }
    }
    else
    {
        SendClientMessage(playerid, color, final);
    }
}



Re: Help me with main chat! - Threshold - 06.04.2013

Yes, but in this case, when defining the maximum chat length, I would change it from 118 to 105 just so it caters for other players using /timestamp. The thread given to you seems like it should help you, but just a tip on the 118 to 105 thing...


Re: Help me with main chat! - Kenrque - 06.04.2013

Let yourself set, so he wants.


Re: Help me with main chat! - BodyBoardVEVO - 06.04.2013

Ok, thanks guys!


Re: Help me with main chat! - Kenrque - 06.04.2013

Np,If you need more help come to pm or pdf