Amon_PRC8/_module/nss/pcinclude.nss
Jaysyn904 c5cffc37af Initial Commit
Initial Commit [v1.01]
2025-04-03 19:00:46 -04:00

25 lines
767 B
Plaintext

// destroys iNumToDestroy items with the specified tag from the specified object's inventory
int DestroyItemsInInventory(object oPC, string sItemTag, int iNumToDestroy);
int DestroyItemsInInventory(object oPC, string sItemTag, int iNumToDestroy)
{
object oFirstItem = GetFirstItemInInventory(oPC);
object oItem = oFirstItem;
int iItemCount = 0;
while(oItem != OBJECT_INVALID && iItemCount <= iNumToDestroy)
{
//SpeakString(GetTag(oItem), TALKVOLUME_SHOUT);
if(GetTag(oItem) == sItemTag)
{
iItemCount++;
DestroyObject(oItem);
}
oItem = GetNextItemInInventory(oPC);
if(oItem == oFirstItem)
{
oItem = OBJECT_INVALID;
}
}
return iItemCount;
}