Persistent SSCANF Issue, Please help me resolve this once and for all.
#2

Don't the prints reveal something?

sscanf("store cocaine", "s[32]", usage) will return "store". After that, you use sscanf(usage, "s[24]", item) and there's no way that the item can be "weapon" or anything like that, since you're actually doing sscanf("store", "s[24]", item)?

Am I wrong here?

So to go further on, I assume the possible usages of your command are:
/trunk store item
/trunk get item
/trunk view

This can be resolved by a simple sscanf!
pawn Код:
new option[32], item[32];
if(sscanf(params, "s[32]S(*)[32]", option, item))
{
        SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk [usage]");
        SendClientMessage(playerid, COLOUR_GREY, "Usages: Store, Get, View");
        return true;
}
if(!strcmp(option, "store", true))
{
    if(item[0] == '*')
    {
        SendClientMessage(playerid, COLOUR_GREY, "USAGE: /trunk store [item]");
        SendClientMessage(playerid, COLOUR_GREY, "Available Items: Weapon, Weed, Cocaine, Money, Armour");
        return true;
    }
    printf("Yay, %s!", item);
}
Reply


Messages In This Thread
Persistent SSCANF Issue, Please help me resolve this once and for all. - by Dokins - 13.03.2012, 18:27
Re: Persistent SSCANF Issue, Please help me resolve this once and for all. - by AndreT - 13.03.2012, 18:38
Re: Persistent SSCANF Issue, Please help me resolve this once and for all. - by [ABK]Antonio - 13.03.2012, 18:40
Re: Persistent SSCANF Issue, Please help me resolve this once and for all. - by Babul - 13.03.2012, 18:53

Forum Jump:


Users browsing this thread: 1 Guest(s)