22.11.2012, 21:26
This isn't the full code, but that's the main part including the SSCANF, the reason I know it's SSCANF is that I commented this part:
And the command executed, but I obviously couldn't get data into it as sscanf couldn't retrieve it.
pawn Код:
if(sscanf(params, "s[24]s[32]d",usage,item,slot))
{
SendClientMessage(playerid, COLOUR_GREY, "Usage: /house store weed [amount]");
return 1;
}
pawn Код:
if(!strcmp(usage, "store", true))
{
printf("USAGE: %s", usage);
if(sscanf(params, "s[24]s[32]",usage,item))
{
SendClientMessage(playerid, COLOUR_GREY, "Usage: /house 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);
HouseWeed[houseid] = MySQL_GetValue(houseid, "HouseWeed", "houses");
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: /house 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);
HouseWeed[houseid] = HouseWeed[houseid] += slot;
Weed[playerid] = Weed[playerid] -= slot;
MySQL_SetInteger(houseid, "HouseWeed", HouseWeed[houseid], "houses");
MySQL_SetInteger(PlayerSQLID[playerid], "Weed", Weed[playerid], "accounts");
format(string, sizeof(string), "You have stored a %d gram(s) of weed in your house.", slot);
SendClientMessage(playerid, COLOUR_BLUE, string);
format(string, sizeof(string), "* %s has stored some drugs in their house.", GetNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
}