Jump to content
McKay Development

Is this correct?


NicoB23

Recommended Posts

Hello good day, I am new to coding. 

mainClient.on('webSession', function(sessionID, cookies) {

   mainManager.setCookies(cookies, function(err) {
      if (err) { // Handle Error.
         console.log(err);
         process.exit(1); // Exit, if we cannot connect, since we can't do anything.
         return;
      }
      mainManager.getInventoryContents(753, 6, true, function(err, inv) { // Load Inventory
         if (err) { // Handle Error.
            console.log('Error, in loading our inventory.')
            return;
         }
         if (inv.length == 0){
           console.log('Inventory is empty, add some items(cheap ones, like trading cards or gems)')
         }
         var firstOffer = mainManager.createOffer(config.accounts.account2.tradelink); // Intialize Trade Offer
         var itemname = inv[0].market_hash_name.toLowerCase();
         console.log('The item in which we are using is a/an ' + itemname)
         firstOffer.addMyItem(inv[0]);
         firstOffer.setMessage(SECURITY_CODE.toString()); // Set a message, so no one can slip in a trade, and try to steal your items.
         firstOffer.send((err, status) => { // Send offer.
            if (status == 'pending') { // Check if it needs to be confirmed.
               mainCommunity.acceptConfirmationForObject(config.accounts.account1.identity_secret, firstOffer.id, function(err) { // Try to accept Trade
                  if (err) { // Handle, any accepting errors.
                     console.log('Error accepting Trade.');
                     return;
                  } else { // It worked fine, Now the farm begins.
                     console.log('Trade offered. Counter is at : ' + counter);
                  }
               });
            }
         });
      });
   });
   // Set Cookies.
   mainCommunity.setCookies(cookies);
});
 
 
If one of the err fails, It cannot return to first. I mean is it stock like example " Error accepting Trade" . Like that. I just want to return until it goes to console.log('Trade offered. Counter is at : ' + counter);. 
Thank you for the help. 

post-4223-0-42945300-1547579054_thumb.png

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