Inventory slots.
#10

pawn Код:
//Somewhere where you add:
ClothesItems[0][0]=10;
ClothesItems[0][1]=20;
ClothesItems[0][2]=30;
ClothesItems[0][3]=40;
ClothesItems[0][4]=60;

HasClothes[0] = 5; //Important line



dcmd_testclothes(pid, params[]) {
    #pragma unused params
    for(new i = 0; i != MAX_SLOTS; i++)
    {
        format(string, sizeof string, "slot %d|item id %d|item %s", i, ClothesItems[pid][i], IsSlotUsed(pid, i) ? ("present") : ("not present"));
        SendClientMessage( playerid, -1, string);
    }
}

stock IsSlotUsed(playerid,slotid)
{
    return bool:ClothesItems[playerid][slotid];
}

stock RemoveClothes(playerid,slotid)
{
    for(new i = slotid + 1; i != HasClothes[playerid]; ++i) {
        ClothesItems[playerid][i - 1] = ClothesItems[playerid][i];
    }
    ClothesItems[playerid][--HasClothes[playerid]] = 0;
    return 1;
}

//Example adding clothes
dcmd_addclothes(pid, params[]) {
    new slotid, clothid;
    if(sscanf(params, "dD(-1)", clothid, slotid)) return SendClientMessage( playerid, -1, "USAGE: /addclothes [clothing id] [slotid]");
    if(-1 == slotid) {
        ClothesItems[pid][HasClothes[pid]++] = clothid;
    } else {
        ClothesItems[pid][slotid] = clothid;
    }
    return SendClientMessage( playerid, -1, "Done");
}
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)