Jump to content
McKay Development

An error occured whilst sending trade offer: Error: HTTP error 401


Recommended Posts

http://pastebin.com/sDi8gSc0 This is my code right now, when I send trades with only my items/my items added it says An error occured whilst sending trade offer: Error: HTTP error 401 but when I send a trade offer where I don't add any of my items (only their items) it works fine, so may I ask how do I stop this error?

 

Here's my code for sending a trade with my items

 

 

  1.     if(type == "withdraw")
  2.     {
  3.     offer.setMessage("By acceppting this offer you will lose " + value + " Gems");
  4.     for (var a = 0; a < itemsToGive.length; a++) {
  5.             offer.addMyItem({"assetid": itemsToGive[a], "appid": 730, "contextid":2});
  6.             console.log(itemsToGive[a]);
  7.         }
  8.     }
 
  1. offer.send(function(err, status) {
  2.             if (err) {
  3.                 console.log("An error occured whilst sending trade offer: " + err);
  4.             }
  5.             if(status == "pending")
  6.             {
  7.                 console.log("Trade offer Pending. Offer #" + offer.id + " Regardless, adding to database with the offer state: 9");
  8.                         tradeData = { tradeofferid: offer.id, steamid: partner, type: type, amount: value, paid: 0, offerState: 9 };
  9.                         connection.query('INSERT INTO csgotrades SET ?', tradeData);
  10.             }
  11.             if (status == "sent") {
  12.                 console.log("Trade offer succesfully sent. Offer #" + offer.id);
  13.                         tradeData = { tradeofferid: offer.id, steamid: partner, type: type, amount: value, paid: 0, offerState: offer.state };
  14.                         connection.query('INSERT INTO csgotrades SET ?', tradeData);
  15.                    
  16.             }
  17.         });
 
 
 
I can send trades with their items fine but with mine I just get the error
  1.     if(type == "withdraw")
  2.     {
  3.     offer.setMessage("By acceppting this offer you will lose " + value + " Gems");
  4.     for (var a = 0; a < itemsToGive.length; a++) {
  5.             offer.addMyItem({"assetid": itemsToGive[a], "appid": 730, "contextid":2});
  6.             console.log(itemsToGive[a]);
  7.         }
  8.     }
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...