sscanf warning: String buffer overflow.
#1

Quote:
Originally Posted by ******
Посмотреть сообщение
fixes 2
pawn Код:
public OnServerMessage(const msg[])
{
    if (!strcmp(msg, "sscanf warning: ", false, 16))
    {
        if (!strcmp(msg[16], "String buffer overflow."))
        {
            SendClientMessage(gLastPlayer, X11_RED, "Please type something shorter");
        }
    }
}
May somebody tell me why it's not working! I decided to use this instead of using "strlen" in each command, but it send the message with returning true for the command.

Example:
pawn Код:
CMD:say(playerid, params[])
{
    new text[50];
    if(sscanf(params, "s[50]", text))return SendClientMessage(playerid, COLOR_WHITE, "/say [text]");
    SendClientMessageToAll(COLOR_GREEN, text);
    return 1;
}
So if the text is above 50 letters, it will send the message to all with "Please type something shorter"
Just Like: /say "text above 50 letters"

Message would be like:
the text that above 50 letters.
Please type something shorter.

Note: I'm using it as a loop as far as gLastPlayer is not defined.
pawn Код:
public OnServerMessage(const msg[])
{
    if (!strcmp(msg, "sscanf warning: ", false, 16))
    {
        if (!strcmp(msg[16], "String buffer overflow."))
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                SendClientMessage(i, COLOR_RED, "Please type something shorter");
            }
        }
    }
}
Reply


Messages In This Thread
sscanf warning: String buffer overflow. - by Juvanii - 24.06.2014, 22:52
Re: sscanf warning: String buffer overflow. - by Ciandlah - 25.06.2014, 06:52
Re: sscanf warning: String buffer overflow. - by ]Rafaellos[ - 25.06.2014, 07:04
Re: sscanf warning: String buffer overflow. - by Juvanii - 25.06.2014, 12:11
Re: sscanf warning: String buffer overflow. - by Jefff - 25.06.2014, 15:33
Re: sscanf warning: String buffer overflow. - by Juvanii - 25.06.2014, 16:20

Forum Jump:


Users browsing this thread: 1 Guest(s)