Jump to content
McKay Development

TomYoki

Member
  • Posts

    82
  • Joined

  • Last visited

Reputation Activity

  1. Like
    TomYoki reacted to Dr. McKay in Server   
    Unfortunately not. I might have worked on reverse-engineering the Source protocol to join a game server, but to join any useful server you'd have to implement VAC which is just insane enough that I'm not touching it.
  2. Like
    TomYoki reacted to Dr. McKay in How would you calculate the amount of metal to add to trade offers?   
    You would probably want to do something like this:
    Initialize a variable to 0 to count the user's owned metal Loop over the user's inventory, and add 9 to that variable for every refined, 3 for every reclaimed, and 1 for every scrap If that variable is If it's >=, then loop over their inventory again, starting with refined and add ref until they don't have any more or the amount you need Keep going with rec and eventually scrap If, at the end, you're short a bit, add the smallest currency unit to go above your required price
  3. Like
    TomYoki reacted to Dr. McKay in Is my bot being Attacked?   
    You're probably running out of memory.
  4. Like
    TomYoki got a reaction from Dr. McKay in amount of Gems in trade offer (itemsToReceive)   
    `amount` property is your friend.
    https://github.com/DoctorMcKay/node-steamcommunity/wiki/CEconItem#amount
  5. Like
    TomYoki reacted to Dr. McKay in Cannot update profile privacy & settings   
    Sorry about that, update to 3.35.1 and it should be good to go.
  6. Like
    TomYoki got a reaction from youssefsoua in Cannot read property 'market_hash_name' of undefined   
    Honestly, don't comment if you have absolutely no clue what's going on.
     
     
    This should work:
     
    EDIT: You also have 3 other issues with your code that I did not notice at first (as I didn't look at the main code).
    1.) You are using a deprecated method. You want to use https://github.com/DoctorMcKay/node-steam-tradeoffer-manager/wiki/TradeOfferManager#getinventorycontentsappid-contextid-tradableonly-callback
    Example: 
    manager.getUserInventoryContents(partner, appid, contextid, true, (err, theirInv) => {...}); 2.)  Line 158 it needs to be either 'var', 'let' or 'const' unless you are wanting to re-define it.
     
    3.)  last issue (that I found) would be on line 163, what you want to do there is change it to 
    var keyToAdd = availableKey[0] //Change it simply to 'availableKey' if you want to add all of the keys found. and from there refer to it as keyToAdd.
     
     
     
    Back to your solution for 'checkAvailableKey' function
    function checkAvailableKey(inventory, acceptedKeyList){ var availableKey = []; //Create an empty array where we can store item data. for(var i=0; inventory.length>i;i++){ //Loop through inventory. if (acceptedKeyList.indexOf(inventory[i].market_hash_name) >= 0){ //Check if there is this item in your array. availableKey.push(inventory[i]); //Push all item info, such as assetid, name, amount etc. } } return availableKey; //return the array with item data. /* P.S: You don't need to make the function ask for the array every time, just add the array with accepted keys in your global scope. However, this is prefered if you have multiple arrays which you want to check. */ }
  7. Like
    TomYoki got a reaction from SayWhat in How to check, if someone commented on a announcement?   
    While we're on this topic, are you planning on adding these features to node-steamcommunity, and something like a feature to get Group comments, as a lot of people are wanting to make a bot that can remove people spamming "Come to this awesomesite.csgo/getScammed.php for free moneeeeeys!!1" .
  8. Like
    TomYoki got a reaction from LuciFer in Getting item id   
    just call 
    manager.getExchangeDetails(); https://github.com/DoctorMcKay/node-steam-tradeoffer-manager/wiki/TradeOffer#getexchangedetailsgetdetailsiffailed-callback
  9. Like
    TomYoki got a reaction from xniceinz in Usage of offer.expires & offer.canceltime   
    Are you wanting to cancel existing offers after X time has passed?
     
    If so, have a look at constructor options: https://github.com/DoctorMcKay/node-steam-tradeoffer-manager/wiki/TradeOfferManager-@-v1#constructoroptions
  10. Like
    TomYoki reacted to Dr. McKay in Is it possible to cancel outgoing offers?   
    You'd need to retrieve the TradeOffer object using getOffer or getOffers then call cancel() on that object.
  11. Like
    TomYoki reacted to Dr. McKay in Error installing node-steamcommunity   
    The npm name is just steamcommunity.
  12. Like
    TomYoki got a reaction from xLeeJYx in How to get the traded items ?   
    offer.itemsToReceive.forEach(function(item) { if (item.appid == "440" && item.market_hash_name == "Scrap Metal") { console.log("It's a bird! It's a plane! IT'S A SCRAP METAL!"); } } ); Something I made you real quick. 
    You can do it the same way for itemsToGive
     
    You can also get some of this info out of it:
    https://github.com/DoctorMcKay/node-steamcommunity/wiki/CEconItem
  13. Like
    TomYoki reacted to SunriseM in Read numbers and/or words from Chat Messages?   
    You can use "split" to convert the string to array and get the part you want. Example:
    client.on('friendOrChatMessage', (senderID, message) => { //Example Message: /bet 45 var arrmsg = message.split(" ") //arrmsg = ["/bet","45"] var userNumber = arrmsg[1] if (message.indexOf("/bet") == 0){ client.chatMessage(senderID, 'Your bet is: ' + userNumber); } });
  14. Like
    TomYoki reacted to SunriseM in get assetIDs by calling getInventoryContents?   
    You should use a loop (for, foreach, while, etc) to iterate all the inventory callback, you can create an array called items, and in each iteration you push a object like this one:
    var item = { "assetid": inventory[i].id, "name": inventory[i].market_hash_name } if you need to make an asynchronous operation with that info and know when all iterations are finished, you can use async module. 
  15. Like
    TomYoki reacted to Dr. McKay in Card Sets   
    The easiest way to determine which game a community item belongs to is to check its market_hash_name. All cards/emoticons/backgrounds have their market_hash_names prefixed with the game's appid and a hyphen (e.g. "440-SCOUT").
×
×
  • Create New...