void ZEPGenderRestrict(object oItem, object oPC)
{
// ---------------------------------------------------
// CEP Gender restriction property script
// Searches the item just equipped for a gender
// restriction property. If it finds it, it will
// check the PC's gender against the appropriate value
// and de-equip the item if they are found not to
// match.
// ---------------------------------------------------
//First we check if this has the item property: Use Limitation: Gender.
//If so, we enter the if statment and check PC gender
//vs. the item's limitation. Else we continue out of the
//function.
if (GetItemHasItemProperty(oItem,ITEM_PROPERTY_USE_LIMITATION_GENDER))
{
itemproperty ipGenderProperty=GetFirstItemProperty(oItem);
//We're not sure if the above property is the one
//we want, so we'll check it vs. the Gender property,
//and, if it's not it, loop through until we find it.
while ((GetIsItemPropertyValid(ipGenderProperty))&&(GetItemPropertyType(ipGenderProperty)!=ITEM_PROPERTY_USE_LIMITATION_GENDER))
{
ipGenderProperty=GetNextItemProperty(oItem);
}
//If, after all that, the property is invalid for
//some reason, we return. Else we now have a property
//with the data of the Gender restriction of teh PC's
//item.
if (!GetIsItemPropertyValid(ipGenderProperty)) return;
//Next line is kind of long and wonky looking, but bear
//with me as I'm doing this to cut out variables.
//We're comparing the item property parameter value (gender
//type) vs. the PCs. Theoretically they use the same
//scale...
//If they are not the same, we de-euip the item
if (GetItemPropertySubType(ipGenderProperty)!=GetGender(oPC))
{
//Not equal, so take it off!
AssignCommand(oPC,ActionUnequipItem(oItem));
//Tell PC why.
string sMessageToPC= GetStringByStrRef(nZEPGenderRestTXT,GENDER_MALE);
SendMessageToPC(oPC,sMessageToPC);
}
}
}