Text lengh
#1

How i can make this ?
http://s10.postimage.org/qyu7krgp5/untitled.png
So, when a line is too long , make a new line with continuation, sry for my english ...

Please help.
Reply
#2

You can use SendPlayerMessageToAll. It'll automatically jump to the next line, if your text is too long.
Reply
#3

I don't want this, i need for an roleplay server.
Reply
#4

Try this
pawn Код:
public OnPlayerText(playerid, text[])
{
    new maxchar = 64; // Maximum characters per line
    new text3[128], pos = 0;
    if(strlen(text) > maxchar)
    {
        new text2[maxchar];
        for(new i=1;pos < strlen(text);i++)
        {
            strmid(text2, text, pos, maxchar*i, sizeof(text2));
            format(text3, sizeof(text3), "%s says: %s", GetName(playerid), text2);
            pos+= strlen(text2);
            ProxDetector(20.0, playerid, text3, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
        }
        return 1;
    }
    else
    {
        format(text3, sizeof(text3), "%s says: %s", GetName(playerid), text);
        ProxDetector(20.0, playerid, text3,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    }
}
pawn Код:
stock GetName(playerid)
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    return pName;
}
PM if it didn't work
Reply
#5

I don't know how to put this in OnPlayerText callback, i have 1000 lines in this callback (The Godfather GM)
Reply
#6

pawn Код:
#define MAX_LINE 64
    new
        len = strlen(params);
    if(len >= MAX_LINE)
    {
        new
            text1[MAX_LINE+1],
            text2[MAX_LINE+1];

        strmid(text1, params, 0, MAX_LINE);
        strmid(text2, params, MAX_LINE, len);

        format(str, sizeof(str), "** %s %s...", NickName(playerid), text1);
        serwerme(playerid, str);

        format(str, sizeof(str), "** ...%s", text2);
        serwerme(playerid, str);
    }
    else
    {
        format(str, sizeof(str), "** %s %s", NickName(playerid), params);
        serwerme(playerid, str);
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)