Issues with optional string on sscanf?
#5

Well, now the other functions don't seem to be working. It's a little strange, I apologise for the delay.

It's to do with the sscanf and I'm not entirely sure.

pawn Код:
if(sscanf(params, "s[24]S(0)[32]D(0)S(0)[12]",usage,item, slot, wepname))
    {
        SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk [usage]");
        SendClientMessage(playerid, COLOUR_GREY, "Usages: Store, Get, View");
        return 1;
    }
I see, thanks for the information regarding the specifier.

However, it does not complete any function within the command, stops after sscanf, but only after I re-wrote the weapons system adding another specifier.

pawn Код:
if(!strcmp(usage, "store", true))
        {
            printf("USAGE: %s", usage);
            if(sscanf(params, "s[24]s[32]",usage,item))
            {
                SendClientMessage(playerid, COLOUR_GREY, "Usage:/trunk store [item]");
                SendClientMessage(playerid, COLOUR_GREY, "Available Items: Weapon, Weed, Cocaine, Money, Armour");
                return 1;

            }
            if(!strcmp(item, "weed", true))
            {
                printf("%s - usage", usage);
                printf("%s - retrieved item", item);
                if(VehicleSQLID[vehicleid] > 0)
                    {
                        VehWeed[vehicleid] = MySQL_GetValue(VehicleSQLID[vehicleid], "VehWeed", "vehicles");
                        Weed[playerid] = MySQL_GetValue(PlayerSQLID[playerid], "weed", "accounts");
                    }
                printf("%d - got weed amount", Weed[playerid]);
                if(sscanf(params, "s[24]s[32]d",usage,item,slot))
                {
                    SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk store weed [amount]");
                    return 1;

                }
                if(slot > Weed[playerid]) return SendClientMessage(playerid, COLOUR_GREY, "You do not have this much weed.");
                printf("%d - amount", slot);
                VehWeed[vehicleid] += slot;
                Weed[playerid] -= slot;
                if(VehicleSQLID[vehicleid] > 0)
                {
                    MySQL_SetInteger(VehicleSQLID[vehicleid], "VehWeed", VehWeed[vehicleid], "vehicles");
                    MySQL_SetInteger(PlayerSQLID[playerid], "Weed", Weed[playerid], "accounts");
                }
                format(string, sizeof(string), "You have stored a %d gram(s) of weed in your vehicle's trunk.", slot);
                SendClientMessage(playerid, COLOUR_BLUE, string);
                format(string, sizeof(string), "* %s has stored some drugs in the vehicle's trunk", GetNameEx(playerid));
                ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
            }
For instance, that was working and now it does not.

Forums messed up the code......

This is what the sscanf used to look like.

pawn Код:
if(sscanf(params, "s[24]S(0)[32]D(0)",usage,item, slot))
    {
        SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk [usage]");
        SendClientMessage(playerid, COLOUR_GREY, "Usages: Store, Get, View");
        return 1;//ok take me back to the place that's not working
    }
The new one asks for a string.
Reply


Messages In This Thread
Issues with optional string on sscanf? - by Dokins - 16.03.2015, 18:24
Re: Issues with optional string on sscanf? - by Vince - 16.03.2015, 19:27
Re: Issues with optional string on sscanf? - by Dokins - 16.03.2015, 19:34
Re: Issues with optional string on sscanf? - by Dokins - 16.03.2015, 22:35
Re: Issues with optional string on sscanf? - by Dokins - 16.03.2015, 23:21

Forum Jump:


Users browsing this thread: 2 Guest(s)