21.07.2013, 11:44
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");
}