Jump to content
McKay Development

How do I add someone else's items to a trade? I know how to add my items, but how do I add my items?


Recommended Posts

Posted (edited)

How do I add someone else's items to a trade offer? I know how to add my items, but how do I add my items?

I've tried changing offer.addTheirItems, but it doesn't seem to work. All it does is give me an error

 

```

function sendKeysSell(link, amt) { 
    try {
        manager.loadPartnerInventory(440, 2, true, (err, inventory) => { 
            if (err) { 
                console.log(err);
                return;
            } 
            let offer = manager.createOffer(link);
            let keys = inventory.filter(item => item.market_name == 'Mann Co. Supply Crate Key');
            let keyAmt = keys.slice(0, amt);
            offer.addTheirItems(keyAmt);
            offer.send((err, status) => {
            if(err) { 
                console.log(err);
            } else{
                console.log(status)
            } 
        }); 
        }); 
    } catch (err) {
    }

function clearFile() {
fs2.truncate('data.txt', 0, function(){
    console.log('\nDATA.TXT FILE CLEARED\n')
});
}

```

Edited by mistathiccums
forgot some text
Posted

do i also have to load my inventory? even if I don't want to add any of my items

function sendKeysSell(link, amt) { 

    try {
        
        offerSell.loadPartnerInventory(440, 2, true, (err, inventory) => { 

            if (err) { 

                console.log(err);
                return;

            } 
            let offerSell = manager.createOffer(link);
            let keys = inventory.filter(item => item.market_name == 'Mann Co. Supply Crate Key');
            let keyAmt = keys.slice(0, amt);
            offerSell.addTheirItems(keyAmt);
            offerSell.send((err, status) => {
            if(err) { 
                console.log(err);
            } else{
                console.log(status)
            } 
        }); 
        }); 
    } catch (err) {
    }



// This still isn't working, I'm not sure what else to do.

The only thing i can think of is that there are untradeable items in that inventory, and that the bot is selecting the untradeable items resulting in an error, how to fix?

Posted

No, you only need to load an inventory that you want to add items from. You don't even technically need to load it if you already know the IDs of the items you want.

There's not a lot I can do to help you with an error if you don't tell me what the error is.

Posted

So I have this function called "sendKeysBuy" that works perfectly fine, but the second function "sendKeysSell", it give me this error " ReferenceError: offer is not defined
    at sendKeysSell (C:\Users\Eberh\Desktop\programs\bots\EnvyMarket Trade Bot\BACKUP 3.12.22.15.42\trade_accepter_bot.js:212:3)
    at Timeout._onTimeout (C:\Users\Eberh\Desktop\programs\bots\EnvyMarket Trade Bot\BACKUP 3.12.22.15.42\trade_accepter_bot.js:118:6)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7) "

 

function sendKeysBuy(link, amt) { 
    try {
        
        manager.loadInventory(440, 2, true, (err, inventory) => { 
            if (err) { 
                console.log(err);
                return;
            }
            let offer = manager.createOffer(link);
            let keys = inventory.filter(item => item.market_name == 'Mann Co. Supply Crate Key');
            let keyAmt = keys.slice(0, amt);
            offer.addMyItems(keyAmt);
            offer.send((err, status) => {
            if(err) { 
                //console.log(err);
            } else{
                //console.log(status)
            } 
        }); 
        }); 
    } catch (err) {
    }
}

function sendKeysSell(link, amt) { 

    try {
        offer.loadPartnerInventory(440, 2, true, (err, inventory) => { 
            if (err) { 
                console.log(err);
                return;
            }
            var offer = manager.createOffer(link);
            let keys = inventory.filter(item => item.market_name == 'Mann Co. Supply Crate Key');
            let keyAmt = keys.slice(0, amt);
            offer.addTheirItems(keyAmt);
            offer.send((err, status) => {
            if(err) { 
                console.log(err);
            } else{
                //console.log(status)
            } 
        }); 
        }); 
    } catch (err) {
        console.log(err);
    }

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...