//Onplayerspawn Just for example
ClothesItems[playerid][1]=10;//i own item 10 in slot 1
ClothesItems[playerid][2]=20;//i own item 20 in slot 2
ClothesItems[playerid][3]=30;//i own item 30 in slot 3
ClothesItems[playerid][4]=40;
ClothesItems[playerid][5]=50;
ClothesItems[playerid][6]=60;
ClothesItems[playerid][7]=70;
ClothesItems[playerid][8]=80;
ClothesItems[playerid][9]=90;
ClothesItems[playerid][10]=100;
//OnPlayerText. It shows a menu with 10 items that you can wear.
//this is to wear the clothes and number is the number that you are typing.
for(new i=0; i < MAX_SLOTS; i++)
{
if(WearClothesItems[playerid][i]==ClothesItems[playerid][number])
{
SendClientMessage(playerid,COLOR_RED,"You already wearing this clothes");
return 0;
}
else
{
ClothesID[playerid]=ClothesItems[playerid][number];
GetClothesID(playerid);
SetPlayerAttachedObject(playerid, GetFreeClothesSlot[playerid], GetClothesID(playerid), GetClothesBoneID(playerid));
EditAttachedObject(playerid, GetFreeClothesSlot[playerid]);
WearClothesItems[playerid][GetFreeClothesSlot[playerid]] = ClothesItems[playerid][number];//This will store the item ids and on what attachmentslot the wearing it.
format(globalstring,sizeof(globalstring),"WearClothesItem[playerid][%d]=%d;",GetFreeClothesSlot[playerid],WearClothesItems[playerid][GetFreeClothesSlot[playerid]]);
SendClientMessage(playerid,-1,globalstring);
GetFreeClothesSlot[playerid]++;
return 0;
}
}
WearClothesItem[playerid][0]=10;
WearClothesItem[playerid][1]=20;
//When i wear item 20 while i am already wearing it its skipping the error code and just wears it on the next slot
WearClothesItem[playerid][2]=20;
for(new i,d; i != MAX_SLOTS; i++)
{
for(d=1; d != 11; d++)
if(WearClothesItems[playerid][i] == ClothesItems[playerid][d])
{
SendClientMessage(playerid,COLOR_RED,"You already wearing this clothes");
return 0;
}
else
{
ClothesID[playerid] = ClothesItems[playerid][d];
GetClothesID(playerid);
SetPlayerAttachedObject(playerid, GetFreeClothesSlot[playerid], GetClothesID(playerid), GetClothesBoneID(playerid));
EditAttachedObject(playerid, GetFreeClothesSlot[playerid]);
WearClothesItems[playerid][GetFreeClothesSlot[playerid]] = ClothesItems[playerid][number];//This will store the item ids and on what attachmentslot the wearing it.
format(globalstring,sizeof(globalstring),"WearClothesItem[playerid][%d]=%d;",GetFreeClothesSlot[playerid],WearClothesItems[playerid][GetFreeClothesSlot[playerid]]);
SendClientMessage(playerid,-1,globalstring);
GetFreeClothesSlot[playerid]++;
return 0;
}
}
Try
pawn Код:
|