Jump to content
McKay Development

Yoki

Member
  • Posts

    5
  • Joined

  • Last visited

Posts posted by Yoki

  1. Hi, I've been stuck with this issue for a while and can't figure any way around it, Right now I have a key bot and script is very simple -

    it checks if all items offered are keys and all items I give is refined, but keys never are round number so my question is how do you make script recognize metals and they value - here's my current script:

    manager.on("newOffer", function(offer) {
      var onlyKeys = (offer.itemsToReceive.every(function(item) {
        return item.name == "Mann Co. Supply Crate Key";
      }));
      var onlyRef = (offer.itemsToGive.every(function(item) {
        return item.name == "Refined Metal";
      }));
      if (onlyKeys, onlyRef) {
        keyAmount = offer.itemsToReceive.length
        refAmount = offer.itemsToGive.length
        console.log("Received trade offer containing " + keyAmount + " keys");
        console.log("Payed" + refAmmount "Refined metal per key.");
        console.log("Accepting the trade.");
        if (keyAmount == refAmount * 27.66)
        offer.accept(function(err) {
          if (err) console.log(err);
        });
    
×
×
  • Create New...