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

pawn Код:
COMMAND:bank(playerid, params[])
{
    new     action[30];
    new     integer;
    new     str[128];
   
    if(IsPlayerInRangeOfPoint(playerid, 5, BANK_X,BANK_Y,BANK_Z))
    {
        if(sscanf(params, "s[30]{i}", action))
        {
            SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /bank <action>");
            SendClientMessage(playerid, COLOR_WHITE, "ACTIONS: withdraw, deposit, balance.");
        }
        else
        {
                if (!strcmp(action, "withdraw", true))
                {
                    if(sscanf(params, "{s[30]}i",integer))
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bank withdraw <amount>");
                    }
                    else
                    {
                        if(PlayerInfo[playerid][playerbank] >= integer)
                        {
                            format(str, 128, "You have withdrawn %i$ from your bank account", integer);
                            SendClientMessage(playerid, COLOR_LIGHTGREEN, str);
                            GivePlayerMoney(playerid, value);
                            PlayerInfo[playerid][playerbank] -= integer;
                            format(str, 128, "New bank balance: %i$", PlayerInfo[playerid][playerbank]);
                            SendClientMessage(playerid, COLOR_LIGHTGREEN, str);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "Invalid amount");
                        }
                    }
                }
                if (!strcmp(action, "deposit", true))
                {
                    if(sscanf(params, "{s[30]}i",integer))
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bank deposit <amount>");
                    }
                    else
                    {
                        if(GetPlayerMoney(playerid) <= integer)
                        {
                            format(str, 128, "You have deposited %i$ into your bank account", integer);
                            SendClientMessage(playerid, COLOR_LIGHTGREEN, str);
                            GivePlayerMoney(playerid, -value);
                            PlayerInfo[playerid][playerbank] += integer;
                            format(str, 128, "New bank balance: %i$", PlayerInfo[playerid][playerbank]);
                            SendClientMessage(playerid, COLOR_LIGHTGREEN, str);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "Invalid amount");
                        }
                    }
                }
                if (!strcmp(action, "balance", true))
                {
                    format(str, 128, "You have %i$ into your bank account.", PlayerInfo[playerid][playerbank]);
                    SendClientMessage(playerid, COLOR_LIGHTGREEN, str);
                }
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You're not in bank.");
    }
    return true;
}
What could be causing this?
Note: Command works perfectly.

It shows that warning if i type /bank withdraw or /bank deposit
Reply
#2

bump
Reply
#3

bump
Reply
#4

ACTIONS: withdraw, deposit, balance.

36 characters not 30

So
pawn Код:
new     action[36];

sscanf(params, "s[36]{i}", action)
And such.
Reply
#5

Damn i got this same problem. :/
Reply
#6

thx kirk for help
Reply
#7

Shouldn't it just be

pawn Код:
if(sscanf(params, "s[30]i", action, amount))
?
Reply
#8

OMG, this thread is almostly one year old.
When I'll get home, I'll post the fixed version of that CMD, so someone could learn from it.
Reply
#9

New guy bumping 7 month old topic ftw.
Reply
#10

bump anyone can share how they fix this warning?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)