Sscanf warnings in console
#1

Hello title is saying my problem.So sscanf is showing me warnings in console.I don`t know what`s the problem

here are warnings
Код:
[12:12:04] sscanf warning: Unenclosed specifier parameters are deprecated, consider using something like p<?>.
[12:12:04] sscanf warning: Strings without a length are deprecated, please add a destination size.
[12:12:04] sscanf warning: Strings without a length are deprecated, please add a destination size.
Reply
#2

Go to the sscanf topic and read the parts about strings and delimiters VERY carefully.
Reply
#3

My mind reader is out of order today, sorry :c
Reply
#4

I fixed warning with delimiters but I can`t with string I don`t see problem in Script....

pawn Код:
stock CheckBan(playerid)
{
    format(post_string, sizeof(post_string), "action=checkip&apikey="#APIKEY"&ban_ip=%s", ips[playerid]);

    HTTP(playerid, HTTP_POST, APIPATH, post_string, "OnCheckResponse");
    return 1;
}
public OnBanResponse(index, response_code, data[])
{
    if(response_code == 200)
        if(strcmp(data, "Success?Ban added", true)) printf("[SAMP-BANS]: Error,  API responded with: %s", data);
        else SendClientMessage(index, 0xFFFFFF, "The ban was added");
    else printf("[SAMP-BANS]: Encountered an error, the page didn't respond");
}

public OnRemoveResponse(index, response_code, data[])
{
    if(response_code == 200)
    {
        if(sscanf(data, "p<?>ss", error, code)) printf("[SAMP-BANS]: Error,  API responded with: %s", data);
        else if(strcmp(error, "Success", true) == 0) SendClientMessage(index, COLOR_RED, code);
    }
    else printf("[SAMP-BANS]: Encountered an error, the page didn't respond");
}

public OnCheckResponse(index, response_code, data[])
{
    if(response_code == 200)
    {
        if(sscanf(data, "p<?>ss", error, code)) printf("[SAMP-BANS]: Error,  API responded with: %s", data);
        else if(strcmp(error, "Success", true) == 0)
        {
            SendClientMessage(index, 0xFFFFFF, code);
            Kick(index);
            printf("[SAMP-BANS]: %s", code);
        }
        else if(strcmp(code, "Ban not found")) printf("[SAMP-BANS]: Error,  API responded with: %s", code);
    }
    else printf("[SAMP-BANS]: Encountered an error, the page didn't respond");
}
Anyone can find problem I can`t find it searching but I don`t see problem
Reply
#5

Anyone can help me?
Reply
#6

Read the goddamn sscanf topic.

Your problems will dissapear if you fix "p<?>ss". Protip: string length
Reply
#7

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Read the goddamn sscanf topic.

Your problems will dissapear if you fix "p<?>ss". Protip: string length
I fix it but now problem with string But i don`t see any problem with string...that is problem
Reply
#8

I'm not native english speaker, but your sentence killed me a little inside. What do you mean?

If you are using space as delimeter, then you have to change "?" to " "
Reply
#9

Quote:
Originally Posted by Misiur
Посмотреть сообщение
I'm not native english speaker, but your sentence killed me a little inside. What do you mean?

If you are using space as delimeter, then you have to change "?" to " "
Look i fix that delimeter but I got problem with string.But string is showed everywhere but...maybe is making problem this string:

pawn Код:
#define MAX_POST_LENGTH MAX_API_LENGTH+MAX_PLAYER_IP+MAX_REASON_LENGTH+MAX_EXTRA_LENGTH+MAX_TIME_LENGTH+MAX_PLAYER_NAME+MAX_PLAYER_NAME

new post_string[MAX_POST_LENGTH];
Reply
#10

Use pawncc with -l parameter, so you'll get your code after preprocessing - then show how the MAX_POST_LENGTH is substituted
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)