SA-MP Forums Archive
Need little help with string lenght - 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: Need little help with string lenght (/showthread.php?tid=323938)



Need little help with string lenght - Gerira Gaijin - 07.03.2012

pawn Код:
CMD:pr(playerid, params[])
{
    if(pInfo[playerid][pRadio] == 0) return SendClientMessage(playerid, COLOR_RED, "[ERROR:] You don't have a portable radio.");
    if(pInfo[playerid][pRadioChannel] == 0) return SendClientMessage(playerid, COLOR_RED, "[ERROR:] You need to set the frequency first (/setfreq).");
    new msg[512];
    if(sscanf(params, "s[512]", msg)) return SendClientMessage(playerid, COLOR_USAGE, "[USAGE:] /pr [text].");
    new string[1024];
    format(string, 1024, "(%i)(Portable Radio) %s: %s",pInfo[playerid][pRadioChannel], RemoveUnderScore(playerid), msg);
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(!IsPlayerConnected(i)) continue
        if(pInfo[i][pRadio] == 0) continue
        if(pInfo[i][pRadioChannel] == 0) continue
        if(pInfo[i][pRadioChannel] == pInfo[playerid][pRadioChannel]){
            SendClientMessage(i, COLOR_RADIO, string);
        }
    }
    format(string, 1024, "(Portable Radio) %s: %s",RemoveUnderScore(playerid), msg);
    ProxDetector(5.0, playerid, string, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
    return 1;
}

At what size should I set the string length? I want the message to be able to fill the whole one line of chat. I used 128 as size before, and the text was cut out at the first third of the screen.


Re: Need little help with string lenght - Campbell- - 07.03.2012

One line can maximally include 128 characters.