I just made a quick system with zcmd and sscanf as an example, you can take a look at it.
In this case, i made you able to cook 3 things at once, and you can pick between tuna and meat.
pawn Код:
new CookingItem1[MAX_PLAYERS];
new CookingQuantity1[MAX_PLAYERS];
new CookingItem2[MAX_PLAYERS];
new CookingQuantity2[MAX_PLAYERS];
new CookingItem3[MAX_PLAYERS];
new CookingQuantity3[MAX_PLAYERS];
CMD:cook(playerid, params[])
{
new item, amount;
if(sscanf(params, "s[128]i", item, amount)) return SendClientMessage(playerid, -1, "USAGE: /cook [item] [amount]");
if(!strcmp(params, "meat", true))
{
SendClientMessage(playerid, -1, "You are now cooking Meat.");
if(CookingItem1[playerid] == 0)
{
CookingItem1[playerid] = meat;
CookingQuantity1[playerid] = amount;
}
else if(CookingItem2[playerid] == 0)
{
CookingItem2[playerid] = meat;
CookingQuantity2[playerid] = amount;
}
else if(CookingItem3[playerid] == 0)
{
CookingItem3[playerid] = meat;
CookingQuantity3[playerid] = amount;
}
else return SendClientMessage(playerid, -1, "You have no more space for cooking.");
}
if(!strcmp(params, "tuna", true))
{
SendClientMessage(playerid, -1, "You are now cooking Tuna.");
if(CookingItem1[playerid] == 0)
{
CookingItem1[playerid] = tuna;
CookingQuantit1[playerid] = amount;
}
if(CookingItem2[playerid] == 0)
{
CookingItem2[playerid] = tuna;
CookingQuantity2[playerid] = amount;
}
else if(CookingItem3[playerid] == 0)
{
CookingItem3[playerid] = meat;
CookingQuantity3[playerid] = amount;
}
else return SendClientMessage(playerid, -1, "You have no more space for cooking.");
}
return 1;
}
After you're done cooking, you have to reset the variable to 0.
EDIT: Just saw i made a flaw in the code, fixed it now.