Jump to content
McKay Development

tf2-node defIndex only returning undifined


Jyn

Recommended Posts


For whatever reason I cant seem to get any values from defIndex. From the first log each item in my backpack is just being returned as having a defIndex of undefined.
what is annoying too is that tf2.backpack[i].id works fine to get the specific item id's. Code below:



tf2.on('backpackLoaded', function () {
log("Loaded our backpack.");
lookforrefined()
});

function lookforrefined() {
var refcount = 0;
for (i = 0; i <tf2.backpack.length; i++) {
log(tf2.backpack[i].defIndex); // only returning 'undefined'

if (tf2.backpack[i].defIndex === 5002) {
refcount++;
log("foundref");
}
}
log(refcount)
};

 

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