29.05.2020, 12:08
(
Last edited by Nexotronix; 29/05/2020 at 01:18 PM.
Reason: Solved!
)
Hello there!
I started to make inventory system for free use, and want to make some kind like a "AutoFreeSlotFinder"
to put Item automaticly to nearest avaible slot using loops.
So, what's wrong here?
Code:
Function Effects are can be seen at the screenshots:
I started to make inventory system for free use, and want to make some kind like a "AutoFreeSlotFinder"
to put Item automaticly to nearest avaible slot using loops.
So, what's wrong here?
Code:
pawn Code:
stock AddItemToInventory(playerid,itemid)
{
for( new SlotID = 0; SlotID < MAX_ITEM_SLOTS; SlotID++)
{
if(SlotInfo[playerid][SlotID][slotUsed] == 0)
{
PutItemToInv(playerid,itemid,SlotID);
}
else if(SlotInfo[playerid][SlotID][slotUsed] == 1 && SlotInfo[playerid][SlotID][slotItemType] == ItemInfo[itemid][ITEM_TYPE])
{
if(SlotInfo[playerid][SlotID][slotItemAmount] < ItemInfo[itemid][ITEM_MAX_VALUE])
{
PlusItemToInv(playerid,itemid,SlotID);
}
else
{
return 0;
}
}
else if(SlotInfo[playerid][SlotID][slotUsed] == 1)
{
UpdateInventory(playerid);
}
else
{
return 0;
}
}
return 1;
}