sscanf warning: Format specifier does not match parameter count.
#1

Hello !

I have this warning, with this code:

pawn Код:
COMMAND:give(playerid, params[])
{
    new id,
        action[36],
        string[144],
        qty;
   
    if(sscanf(params, "s[36]", action))
    {
        return SendClientMessage(playerid, -1, "Usage: /give <item> <id> <qty>");
    }
   
    if(!strcmp(action, "test", true, 4))
    {
        if(sscanf(params, "s[36]ud", action, id, quantite))
        {
            return SendClientMessage(playerid, -1, "Usage: /give test <id> <qty>");
        }
    }
    return 1;
}
Thx!
Reply
#2

You can to do like that :
pawn Код:
COMMAND:give(playerid, params[])
{    
    if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /give <item> <id> <qty>");
   
    new
        id,
        qty;

    if(strcmp(params, "test", true, 4) == 0)
    {
        if(sscanf(params, "'test 'ud", id, qty)) return SendClientMessage(playerid, -1, "Usage: /give test <id> <qty>");
       
        // actions
    }
   
    else if(strcmp(params, "autre", true, 5) == 0)
    {
        if(sscanf(params, "'autre 'ud", id, qty)) return SendClientMessage(playerid, -1, "Usage: /give autre <id> <qty>");
       
        // actions
    }
   
    return SendClientMessage(playerid, -1, "Item list : dsfsdfsdf");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)