13.03.2012, 18:38
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!
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);
}