Replacing current Hat/Mask
Jerryiee opened this issue · 0 comments
Jerryiee commented
I repaired hat/mask replacing with add this code.
HAT
stock SetPlayerHatItem(playerid, itemid)
{
**new actualhat = GetPlayerHatItem(playerid);
if(IsValidItem(actualhat))
return 0;**
if(!IsValidItem(itemid))
return 0;
new ItemType:itemtype = GetItemType(itemid);
if(!IsValidItemType(itemtype))
return 0;
new hatid = hat_ItemTypeHat[itemtype];
if(hatid == -1)
return 0;
new skinid = GetPlayerClothes(playerid);
if(!GetClothesHatStatus(skinid))
return 0;
SetPlayerAttachedObject(
playerid, ATTACHSLOT_HAT, GetItemTypeModel(itemtype), 2,
hat_Data[hatid][skinid][hat_offsetX], hat_Data[hatid][skinid][hat_offsetY], hat_Data[hatid][skinid][hat_offsetZ],
hat_Data[hatid][skinid][hat_rotX], hat_Data[hatid][skinid][hat_rotY], hat_Data[hatid][skinid][hat_rotZ],
hat_Data[hatid][skinid][hat_scaleX], hat_Data[hatid][skinid][hat_scaleY], hat_Data[hatid][skinid][hat_scaleZ]);
RemoveItemFromWorld(itemid);
RemoveCurrentItem(GetItemHolder(itemid));
hat_CurrentHatItem[playerid] = itemid;
return 1;
}
MASK
stock SetPlayerMaskItem(playerid, itemid)
{
**new actualmask = GetPlayerMaskItem(playerid);
if(IsValidItem(actualmask))
return 0;**
if(!IsValidItem(itemid))
return 0;
new ItemType:itemtype = GetItemType(itemid);
if(!IsValidItemType(itemtype))
return 0;
new maskid = mask_ItemTypeMask[itemtype];
if(maskid == -1)
return 0;
new skinid = GetPlayerClothes(playerid);
if(!GetClothesMaskStatus(skinid))
return 0;
SetPlayerAttachedObject(
playerid, ATTACHSLOT_FACE, GetItemTypeModel(itemtype), 2,
mask_Data[maskid][skinid][mask_offsetX], mask_Data[maskid][skinid][mask_offsetY], mask_Data[maskid][skinid][mask_offsetZ],
mask_Data[maskid][skinid][mask_rotX], mask_Data[maskid][skinid][mask_rotY], mask_Data[maskid][skinid][mask_rotZ],
mask_Data[maskid][skinid][mask_scaleX], mask_Data[maskid][skinid][mask_scaleY], mask_Data[maskid][skinid][mask_scaleZ]);
RemoveItemFromWorld(itemid);
RemoveCurrentItem(GetItemHolder(itemid));
mask_CurrentMaskItem[playerid] = itemid;
return 1;
}