08.04.2014, 17:25
Hold on I added this, try it:
Tell me if this works or not, and if you need help ask me.
pawn Код:
#define MAX_INVENTORY_SLOTS 20
enum pInventory
{
pID,
pSlot[20],
pName[128]
}
new PlayerInventory[MAX_PLAYERS][pInventory];
CMD:i(playerid, params[])
{
new item;
if(strcmp(params[0], "use"){
if(sscanf(params[1],"i", item)) return SendClientMessage(playerid, SERVER_USAGE, "Correct Usage: /i use [Inventory Item]");
if(pInfo[playerid][pJob] = 12) // Made Up Number, Should Represent The Job ID //
{
// Use a function that will get all inventory and check if the id in "item" is in it
if(CheckItemInInventory(playerid, item)) // If returns true
{
// Do Action or Give Player Weapon or what ever you wanna do with it
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "You do not have this item!");
}
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "You need to be a Car Jacker / Mechanic");
}
}
}
return 1;
}
stock CheckItemInInventory(playerid, item)
{
for(new x=0;x<MAX_INVENTORY_SLOTS;x++)
{
if((PlayerInventory[playerid][pSlot][x]) == item) return true;
}
return 0;
}