SA-MP Forums Archive
Client Message Appear Truncated - 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: Client Message Appear Truncated (/showthread.php?tid=416065)



Client Message Appear Truncated - ReDevilGames - 15.02.2013

So, this is my code:
pawn Код:
CMD:b(playerid, params[])
{
    if (PlayerData[playerid][LoggedIn] == 1 && PlayerData[playerid][Tutorial] == 20)
    {
        new SayString[128]; if (sscanf(params,"s",SayString)) return SendClientMessage(playerid, 0xFF0000AA,"USAGE: /b [Testo]");
        new PlayerName[256]; GetPlayerName(playerid,PlayerName,MAX_PLAYER_NAME);
        PlayerName = str_replace("_"," ",PlayerName);
        if (PlayerData[playerid][Sex] == 0) format(SayString,sizeof(SayString),"{00FFFF}(( {0080FF}%s{00FFFF}: %s ))",PlayerName,SayString);
        else if (PlayerData[playerid][Sex] == 1) format(SayString,sizeof(SayString),"{00FFFF}(( {FF00FF}%s{00FFFF}: %s ))",PlayerName,SayString);
        SendClientMessageToAll(0xFFFFFFFF,SayString);
    }
    return 1;
}
So, if I type /b hello everyone, I hope my roleplay will be nice to you!, the output will be (( Stupid_Boy: hello everyone, I hope my roleplay wil ))
WHY?


Re: Client Message Appear Truncated - zxc1 - 16.02.2013

Increase the 'SayString' array. (put it for example 256 characters)


Re: Client Message Appear Truncated - RajatPawar - 16.02.2013

Quote:
Originally Posted by zxc1
Посмотреть сообщение
Increase the 'SayString' array. (put it for example 256 characters)
No, that wouldn't change anything since the max output in SCM is 128 per line.


Re: Client Message Appear Truncated - T0pAz - 16.02.2013

Use this instead of SendClientMessage and increase your array size.

pawn Код:
#define MAX_CHARS_PER_LINE (80)
// Max characters per line.
#define FINAL_DOTS
// Remove it if you don't want dots for new lines.

stock BigMessage(playerid, colr, message[])
{
    new len = strlen(message),
        _iL = len / MAX_CHARS_PER_LINE;

    if( ( len % MAX_CHARS_PER_LINE ) ) _iL++;
    new _Line[MAX_CHARS_PER_LINE + 5];

    new _:_i@Index;
    while( _i@Index < _iL )
    {
        if( _i@Index == 0 )
            strmid( _Line, message, ( _i@Index * MAX_CHARS_PER_LINE ), ( _i@Index * MAX_CHARS_PER_LINE ) + MAX_CHARS_PER_LINE );
        else
            strmid( _Line, message, ( _i@Index * MAX_CHARS_PER_LINE ), ( _i@Index * MAX_CHARS_PER_LINE ) + MAX_CHARS_PER_LINE );

        #if defined FINAL_DOTS
        if( _iL > 1 )
        {
            if( _i@Index == 0 )
            {
                format( _Line, sizeof _Line, "%s ...", _Line );
            }
            else if( _i@Index > 0 && ( _i@Index + 1 ) < _iL )
            {
                format( _Line, sizeof _Line, "... %s ...", _Line );
            }
            else
            {
                format( _Line, sizeof _Line, "... %s", _Line );
            }
        }
        #endif
        ////////////
        SendClientMessage(playerid, colr, _Line );
        ///////////
        _i@Index++;
    }
}



Re: Client Message Appear Truncated - Luis- - 16.02.2013

Try this;
Код:
CMD:b(playerid, params[])
{
    if (PlayerData[playerid][LoggedIn] == 1 && PlayerData[playerid][Tutorial] == 20)
    {
        new SayString[128]; if (sscanf(params,"s[128]",SayString)) return SendClientMessage(playerid, 0xFF0000AA,"USAGE: /b [Testo]");
        new PlayerName[MAX_PLAYER_NAME]; GetPlayerName(playerid,PlayerName,MAX_PLAYER_NAME);
        PlayerName = str_replace("_"," ",PlayerName);
        if (PlayerData[playerid][Sex] == 0) format(SayString,sizeof(SayString),"{00FFFF}(( {0080FF}%s{00FFFF}: %s ))",PlayerName,SayString);
        else if (PlayerData[playerid][Sex] == 1) format(SayString,sizeof(SayString),"{00FFFF}(( {FF00FF}%s{00FFFF}: %s ))",PlayerName,SayString);
        SendClientMessageToAll(0xFFFFFFFF,SayString);
    }
    return 1;
}