SA-MP Forums Archive
sscanf warning: Format specifier does not match parameter count. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: sscanf warning: Format specifier does not match parameter count. (/showthread.php?tid=262506)



sscanf warning: Format specifier does not match parameter count. - WooTFTW - 18.06.2011

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


Re: sscanf warning: Format specifier does not match parameter count. - WooTFTW - 19.06.2011

bump


Re: sscanf warning: Format specifier does not match parameter count. - WooTFTW - 20.06.2011

bump


Respuesta: sscanf warning: Format specifier does not match parameter count. - kirk - 20.06.2011

ACTIONS: withdraw, deposit, balance.

36 characters not 30

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

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


Re: sscanf warning: Format specifier does not match parameter count. - Kerlan - 03.11.2011

Damn i got this same problem. :/


Re: sscanf warning: Format specifier does not match parameter count. - Liviutz1010 - 25.05.2012

thx kirk for help


Re: sscanf warning: Format specifier does not match parameter count. - MP2 - 25.05.2012

Shouldn't it just be

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


Re: sscanf warning: Format specifier does not match parameter count. - WooTFTW - 25.05.2012

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.


Re: sscanf warning: Format specifier does not match parameter count. - MP2 - 25.05.2012

New guy bumping 7 month old topic ftw.


Re: sscanf warning: Format specifier does not match parameter count. - burnuk - 14.08.2012

bump anyone can share how they fix this warning?