You would need to have a loop within the loop. The "outer" loop goes through and finds the bags (like you have). The "inner" loop would then go through and destroy the contents of the bag before destroying the bag itself and moving on to the next bag (in the outer loop).
Example (part pseudo-code):
object oBag = Your First BodyBag;
while(GetIsObjectValid(oBag)) // Outer Loop - Find a Bag
{
object oInv = GetFirstItemInInventory(oBag);
while(GetIsObjectValid(oInv)) // Inner Loop - Destroy Bag's Inventory
{
DestroyObject(oInv, 0.0, FALSE);
oInv = GetNextItemInInventory(oBag);
} // End Inner Loop
if(oInv == OBJECT_INVALID) // If all inventory has been destroyed destroy Bag itself
{
DestroyObject(oBag, 0.0, FALSE);
}
oBag = Your Next BodyBag;
} // End Outer Loop
Modifié par _Knightmare_, 21 novembre 2010 - 02:03 .