Inventory slots.
#2

If you have foreach include, read the section about custom iterators. Otherwise:

pawn Код:
stock RemoveClothes(playerid,slotid)
{
    ClothesItems[playerid][slotid] = 0;
    for(new i = slotid + 1; i != HasClothes[playerid]; ++i) {
        ClothesItems[playerid][i - 1] = ClothesItems[playerid][i];
    }
    HasClothes[playerid]--;
    return 1;
}
1. Remove item
2. Move all items to -1 slot
3. Decrease number of clothes

Remember to update HasClothes on addition/removal of clothes.

There is also fancy way using pointer swapping (introduced by Slice https://sampforum.blast.hk/showthread.php?tid=343172 ), but I think it won't be necessary.
Reply


Messages In This Thread
Inventory slots. - by Admigo - 21.07.2013, 09:36
Re: Inventory slots. - by Misiur - 21.07.2013, 09:57
Re: Inventory slots. - by Admigo - 21.07.2013, 10:12
Re: Inventory slots. - by Misiur - 21.07.2013, 10:27
Re: Inventory slots. - by Admigo - 21.07.2013, 10:40
Re: Inventory slots. - by Misiur - 21.07.2013, 10:51
Re: Inventory slots. - by Admigo - 21.07.2013, 10:58
Re: Inventory slots. - by Misiur - 21.07.2013, 11:01
Re: Inventory slots. - by Admigo - 21.07.2013, 11:10
Re: Inventory slots. - by Misiur - 21.07.2013, 11:44

Forum Jump:


Users browsing this thread: 2 Guest(s)