EnelGy Posted September 6, 2020 Report Posted September 6, 2020 (edited) I have copied this code and need help what i need to change to make it work... Items that bot is requiring opponent has, so the item is existing and if the guy doesnt have the item, console says that. I got this error and dont know why.. . the script is here if(isNaN(amount) || amount === undefined){ console.log('invalid number'); } else{ var count = 0; var i = 0; console.log("Creating Offer, please wait!"); //Check Players inventory for the keys, and make sure we have enough sets to supply var offer = manager.createOffer(_message); offer.getPartnerInventoryContents(440, 2, function(err, inventory, currencies){ if(err){ console.log(err); } var a = []; for(var i = 0; i < inventory.length; ++i){ if(inventory.market_hash_name == 'Refined Metal' && a.length < amount){ console.log("Adding Item"); a.push(inventory.id); offer.addTheirItem({id: inventory.id, appid: 440, contextid: 2}); console.log("Length of a "+a.length); console.log(a); ++count; } } inventory.forEach(function(val){ if(val.market_hash_name == 'Refined Metal'){ console.log("Adding Item"); offer.addTheirItem({id: val.instanceid, appid: 440, contextid: 2}); ++count; } }); if(count < amount){ console.log("count: "+count); console.log("You don't have enough keys for me to send this trade."); } else{ offer.send(function(err, status){ if(err){ console.log(err); console.log("An Error has Occured while sending offer."); } if(status == "pending"){ console.log("Confirming Offer!"); } if(status == "sent"){ console.log("Offer Sent!"); } }); } }); } Edited September 7, 2020 by EnelGy Quote
Dr. McKay Posted September 8, 2020 Report Posted September 8, 2020 Re-post with a code block so bbcode doesn't immolate your code. 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.