Inventory slots.
#3

Quote:
Originally Posted by Misiur
Посмотреть сообщение
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.
Thanks for your code but it still returns when i use /testclothes
Код:
slot 1|item id 10
slot 3|item id 30
It should return as:
Код:
slot 1|item id 10
slot 2|item id 30
Can you help me fix this?

EDIT:
I tried to remove slot 1 and it returns as:
Код:
slot 1|item id 20
slot 2|item id 20
slot 3|item id 30
It should return as:
Код:
slot 1|item id 20
slot 2|item id 30
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: 3 Guest(s)