Jump to content
McKay Development

Function that returns the assetid of specific item - basic -


chnel

Recommended Posts

Hi there,

i've been doing some tries as hobby and i wanted to share with you. I believe it will be usefull.

 

before read or copying the code just consider some valuable;

♦manager is a call from TradeOfferManager, so you will need to replace atleast tags.

var manager = new TradeOfferManager({"steam":client,"domain":"google.com","language":"en"});
function getInv(sTeamID,itmName)
{
  manager.loadUserInventory(sTeamID,730,2,false,function(err,inventory)
  {
    if(err)
    {
      console.log("[WARNING]: Couldn't load inventory of " + sTeamID + "!");
    }
    else
    {
      console.log(sTeamID+"inventory loaded");
      for (var p = 0;p<inventory.length;p++)
      {
        if(inventory[p].market_hash_name == itmName)
        {
          return inventory[p].assetid;
        }
        else
        {
          console.log(sTeamID+"item could not found");
          return false;
        }
      }
    }
  }
)
}

How to use :

 

explanation of valuables;

 

sTeamID : is the steamid of the person who own's that inventory.

itmName : is the item that you want to get assetid you need to set here market_hash_name.

 

Example using :

var hisItem = getInv("[U:1:00000000]","P2000 | Fire Elemental (Factory New)");

That will return to you asset id with that you can easily send trade offers.

Also you can combine with https://dev.doctormckay.com/topic/643-function-that-sends-offer-basic/ this to send trade easy as well.

 

Note : that function have been written for CSGO if you want to use this for other apps just edit the appid with yours or you could add a valuable to function and send it while calling the function.

Edited by chnel
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...