Well, i haven't teseted this and I wasnt sure how you meant to only loop through six players, but this will loop through all the players on the server and do what you need. If i did it right:whistle:.
This is probably going to be a lag monster and not something you want to do all the time. Two loops inside a loop can't be good. But anyway:
void main()
{
object oChest = GetObjectByTag("Tag of chest here");//
put your chest's tag here object oPC = GetFirstPC();
while (GetIsObjectValid(oPC))
{
object oItem;
int iValue;
oItem = GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem))
{
iValue = GetGoldPieceValue(oItem);
if (iValue < 20000)
DestroyObject(oItem);
else
{
CopyItem(oItem, oChest, TRUE);
DestroyObject(oItem);
}
oItem = GetNextItemInInventory(oPC);
}
int iSlot;
for (iSlot=0; iSlot<NUM_INVENTORY_SLOTS; iSlot++)
{
oItem = GetItemInSlot(iSlot, oPC);
iValue = GetGoldPieceValue(oItem);
if (iValue < 20000)
DestroyObject(oItem);
else
{
CopyItem(oItem, oChest, TRUE);
DestroyObject(oItem);
}
}
oPC = GetNextPC();
}
}
This also gets equipped items. Not sure if you wanted to get those as well.
Hope this helps.
NOTE: This will also destroy plot items. And when checking the gold cost value of an item that is not identified, it will get it's base value...not its idendified value. If these things need to be taken into consideration then let me know so we can update the script above.
Modifié par GhostOfGod, 03 novembre 2010 - 08:12 .