Aller au contenu

Photo

Quick Tip: Script to get users max & current inventory count before adding items for example.


  • Veuillez vous connecter pour répondre
Aucune réponse à ce sujet

#1
JackFuzz

JackFuzz
  • Members
  • 408 messages
How do you know if the user has enough inventory space before adding items?

//Get max inventory size
int iMaxInventorySize = GetMaxInventorySize(GetHero());
//get current inventory count
object[] oInv = GetItemsInInventory(GetHero(), GET_ITEMS_OPTION_BACKPACK, 0, "", 1);
   
PrintToLog("Max Inventory size:" + IntToString(iMaxInventorySize));
PrintToLog("Current Inventory count:" + IntToString(GetArraySize(oInv)));

This returned 102 items in my inventory out of a total of 120. 

Enjoy

Modifié par JackFuzz, 17 janvier 2010 - 11:28 .