SSCANF error, command won't work correctly.
#1

Here I have a command, it is '/give' with optional parameters.

The command is: /give [player id or name] [drug/weapon/mats] [amount], but the amount isn't setting upon the "mats" section.

Here is the code:

[pawn]

pawn Код:
command(give, playerid, params[])
{
    new id, section[12], type[12], amount, string[128];
    if(sscanf(params, "us[12]S[12]I(0)", id, section, type, amount))
That's the sscanf line, here is the "mats" section:

pawn Код:
else if(strmatch(section, "mats"))
        {
            if(amount == 0)return SendClientMessage(playerid, GREY, "Usage: /give [player id or name] mats [amount]");
            if(Player[playerid][Materials] >= amount)
            {
                Player[playerid][Materials] -= amount;
                Player[id][Materials] += amount;
                format(string, sizeof(string), "%s has given you %d materials.", MaskName(playerid), amount);
                SendClientMessage(id, SHOUT, string);
                format(string, sizeof(string), "You have given %d materials to %s.", amount, MaskName(id));
                SendClientMessage(playerid, SHOUT, string);
                format(string, sizeof(string), "* %s hands over some materials to %s. *", MaskName(playerid), MaskName(id));
                CloseMessage(playerid, ACTION, string);
            }
            else return SendClientMessage(playerid, GREY, "You don't have that many materials.");
        }
It's not allowing me to change the "amount" parameter, please help.
Reply


Messages In This Thread
SSCANF error, command won't work correctly. - by iGetty - 20.01.2013, 18:43
Re: SSCANF error, command won't work correctly. - by Red_Dragon. - 20.01.2013, 19:06
Re: SSCANF error, command won't work correctly. - by iGetty - 20.01.2013, 19:13
Re: SSCANF error, command won't work correctly. - by Roach_ - 20.01.2013, 20:04

Forum Jump:


Users browsing this thread: 2 Guest(s)