Jump to content
McKay Development

Recommended Posts

Hi there. I found a code from gihub and idk if it is working... because it doesnt do anything.

user.on('inventory', function (backpack, craft, err) {
	var inventory = backpackLoaded
	var random_refined = getRandomRefinedID(inventory);
	tf2.craftItems([random_refined]); // will smelt first refined found in the inventory
	setTimeout(function() {
    steamTrade.loadInventory(440, 2, function(inventory1) { // reload inventory
        console.log("loaded new inventory 1");
        if (JSON.stringify(inventory1) !== JSON.stringify(inventory)) { // if inventory has changed
            console.log("got the new backpack!");
            var random_reclaimed = getReclaimedIDs(inventory1, inventory); //get the id of a reclaimed smelted before
            tf2.craftItems([random_reclaimed]); // smelt it to a scrap
            setTimeout(function() {
                steamTrade.loadInventory(440, 2, function(inventory2) { // reload inventory
                    console.log("loaded new inventory 2");
                    if (JSON.stringify(inventory2) !== JSON.stringify(inventory1)) { // if inventory has changed
                        console.log("Yes, new backpack!");
                        inventory = inventory2;
                    } else {
                        console.log("oh no , still the old one");
                    }
                });
            }, 10000);
        } else {
            console.log("still as the old one :(");
        }
    });
}, 10000);
})
Edited by TextDynasty
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...