Jump to content
McKay Development

Trade offer error 26


EnelGy

Recommended Posts

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

.image.thumb.png.a4bdbc15bc52e9608de6f8438da1a2be.png 

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