jafix Posted March 8, 2017 Report Posted March 8, 2017 manager.on('newOffer', function (offer) { var onlyCards = (offer.itemsToReceive.every(function(item) { return item.tag == "Trading card" && item.tag == "Not Marketable"; })); console.log('[OFFER] Checking offer containments'); if (onlyCards) { receiveCardAmount = offer.itemsToReceive.length giveCardAmount = offer.itemsToGive.length if (receiveCardAmount == 2) { console.log('[OFFER] Received items = 2'); if (giveCardAmount == 1) { console.log('[OFFER] Given items = 1'); offer.accept(); client.chatMessage('76561198259000054', 'Trade offer #' + offer.id + ' from ' + offer.partner.getSteamID64() + ' accepted. 2 new cards in inventory'); tradelog.info('Trade offer #' + offer.id + ' from ' + offer.partner.getSteamID64() + ' accepted. 2 new cards in inventory') console.log('[OFFER] Accepted - contains correct items'); } } } else { offer.decline(); console.log('[OFFER] Declined - contains non card items or not the correct amount'); tradelog.info('Offer #' + offer.id + ': Declined - contains non card items') } } }); }); My offer gets declined even though I'm sure I matched everything. I think it's with the tags but it might be a problem with the item amount Quote
TomYoki Posted March 9, 2017 Report Posted March 9, 2017 1#Tags are an array.2#Items in trade-offers don't have tags. Quote
Recommended Posts
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.