Making text string longer
#1

Код:
COMMAND:o(playerid, params[])
{
    new text[258];
    if(!sscanf(params, "s", text))
    {
        new name[MAX_PLAYER_NAME], string[350];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(text), "%s:  [[%s]] ", name, text);
        SendClientMessageToAll(COLOR_WHITE, string);
        return 1;
    }
    else return SendClientMessage(playerid, COLOR_RED, "USAGE: /o [Text]");
}
That is my code, but I can type like maximum of 60 characters when I use /o

Any idea?
Reply
#2

I'm not sure but you should write new text[256]; but not 258
Reply
#3

Max chat string is about 150 (since 0.3c). There is no need of using 256.

pawn Код:
COMMAND:o(playerid, params[])
{
    new text[150];
    if(sscanf(params, "s[150]", text))
    {
        new name[MAX_PLAYER_NAME], string[150];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(text), "%s:  [[%s]] ", name, text);
        SendClientMessageToAll(COLOR_WHITE, string);
        return 1;
    }
    else return SendClientMessage(playerid, COLOR_RED, "USAGE: /o [Text]");
}
Also, sscanf returns 0 on success, therefore you don't do "!sscanf."

Which version of sscanf are you using? You're probably not using the newest since you put strings without string size. Use the newest sscanf, find it with the "search" feature.
Reply
#4

the code u posted should work?
Reply
#5

It should if you're using the newest sscanf plugin (or possibly sscanf stock?), try it, if it doesn't, you need another plugin.
Reply
#6

128 is maximum for SendClientMessage..
Reply
#7

Quote:
Originally Posted by ivanVU
Посмотреть сообщение
128 is maximum for SendClientMessage..
No, it isn't. Since 0.3c, there was color embedding, and that embedding increased it to about 150. It is not 128 any more. It was 128 in SA-MP 0.3b and earlier.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)