Jump to content
McKay Development

theFarmer

Member
  • Posts

    3
  • Joined

  • Last visited

theFarmer's Achievements

  1. I am just noting my progress. It seems that the assetid is not unique to the item, even though I assumed it was. Searching for the name, I was able to find that the amount of items exists, just that each one's assetid was different. So, I will try to take my requested items and match them against the inventory using the market_hash_name instead. I will post back with the outcome on this. Yep! That fixed it. Maybe a better way but my solution looks something like: function prepareTrade(combinedItems, inventory) { let allAssetIds = []; combinedItems.forEach(item => { // Find the index of the item in inventory that matches the current item const foundIndex = inventory.findIndex(invItem => invItem.market_hash_name === item.markethashname); if (foundIndex !== -1) { // If the item is found, push its asset id and remove it from the inventory allAssetIds.push(inventory[foundIndex].assetid); inventory.splice(foundIndex, 1); } }); return allAssetIds; }
  2. allAssetIDs is just an external array of "owed items" that I loop through to construct the formatted array. If select the same skin twice, I just update the amount to 2 (or whatever number is needed)
  3. Hi all! I am able to generate trades from my "bot" account using `offer.addMyItems(items)` as long as there aren't more than 1 of each item. The moment I trie to add a second item I face issues. I am combining and updating the amount. Here are two console logs: [[[allAssetIds]]] [ '4472701497518213337', '4472701497518213337', '4472701497518213337', '4472701497518213337', '4472701497519256933' ] [[[FORMATEED TEMS]]] [ { appid: 252490, contextid: '2', assetid: '4472701497518213337', amount: 4 }, { appid: 252490, contextid: '2', assetid: '4472701497519256933', amount: 1 } ] The first is the raw items I need to add, and the second is my "formatted" items. However, I get the "Error: There was an error sending your trade offer. Please try again later. (26)" error. It only happens if there is more than 1 of an item, so I think I'm doing something wrong rather than something wrong with the library. Thanks so much!
×
×
  • Create New...