TextDynasty Posted October 14, 2016 Report Posted October 14, 2016 Hi McKay, idk why my offer was declined everytime i sent a correct offer Here is my code manager.on("newOffer", function(offer) { var metal = 0 var key = 0 var BuyKey = (offer.itemsToReceive.forEach(function(item) { if (item.name == "Mann Co. Supply Crate Key") return key++ })); var FromRef1 = (offer.itemsToGive.forEach(function(item) { if (item.name == "Refined Metal") return metal += 9 if (item.name == "Reclaimed Metal") return metal += 3 if (item.name == "Scrap Metal") return metal++ })); if (BuyKey && FromRef1) { if (metal == key) { offer.accept(function(err) { if (err) console.log(err); else console.log("They are selling " + key + " keys for " + buykeyprice * key + " refined metal."); console.log(colors.red("Accepting the trade offer.")); console.log(colors.green("Trade offer accepted.")); }); }} else { console.log("Trade offer not validated. Declining"); console.log("They offered " + key + " keys and " + metal + " refined metals. ") offer.decline(function(err) { if (err) console.log(err); }); } });
Dr. McKay Posted October 15, 2016 Report Posted October 15, 2016 Spamming threads won't get you (free) help any faster.
Recommended Posts