Jump to content
McKay Development

Recommended Posts

Posted

Following is my Codes:

 

function processOffer(offer) {
    if(offer.isGlitched() || offer.state === 11) {
        console.log("This offer is Glitched! decline.");
        declineOffer(offer);
    } 

    else if (offer.partner.getSteamID64() === config.trashint) {
        acceptOffer(offer);
    }

    else{
        var ourItems = offer.itemsToGive;
        console.log(ourItems)
        var theirItems = offer.itemsToReceive;
        var ourValue = 0 ;
        var theirValue = 0;
        for  (var i in ourItems) {
            var item = community.market_hash_name;
            console.log(item)
            if(prices[item]) {
                ourValue += prices[item].sell;

            } else {
                console.log("invaild Value.");
                ourValue += 99999; 
            }
        }

        for  (var j in ourItems) {
            var item= community.market_hash_name[j];
            console.log(item)
            if(prices[item]) {
                theirValue += prices[item].buy;
            } else {
                console.log("Their Values was Different.");

            }
        }
        console.log("Our value: "+ ourValue);
        console.log("Their value:"+ theirValue);


        if(ourValue <= theirValue) {
            acceptOffer(offer);
        }

        else {
            declineOffer(offer);
        }
    }
}

 

When i run it:

 

C:\Users\user\Desktop\steambot\steambot.js:103
                        var item = community.market_hash_name;
                                                             ^

TypeError: Cannot read property '0' of undefined

 

what should i change? is it syntax error?

 

 

 

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