Jump to content
McKay Development

Raminos

Member
  • Posts

    5
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Raminos got a reaction from Dr. McKay in logOn catch error event.   
    Tnks a lot doc!, very appreciated for the patience answering,
    Have a great week!
    Rami~
  2. Thanks
    Raminos reacted to Dr. McKay in logOn catch error event.   
    To handle errors:
    client.on('error', function(err) { // do something with err (which will never be null or undefined in this event) }); You aren't going to be able to do anything with limited inside of the loggedOn event. The data isn't going to be available yet. loggedOn gets emitted when Steam sends us back the logon response saying that your logon was successful, but Steam doesn't send us our account limitations for another second or so, which is why the data is undefined/null inside of the loggedOn event.
  3. Like
    Raminos got a reaction from Dr. McKay in Problem with WebSession   
    Tnks for the reply!
    I only use the api for the bot, the only other place in where i have put it, is in https://steamapi.xpaw.me/  to get the automatic reference, but i don't think that that can make any other particular load or use it more than to generate the automatic reference.
    Tnks again!, i'll exit SDA, change the ip, and if there is no diference, i'll let it rest 2-3 days, change ip again and check what happens.
    Have a great week!
    Rami.
  4. Thanks
    Raminos reacted to Dr. McKay in Problem with WebSession   
    I don't really know how SDA works as I've never used it, but you might try exiting it for a day or two and see if that helps.
    Have you tried using a different IP address? It seems to me like sometimes Steam just flags a particular account or API key on a particular IP. You might try using a different IP, or check where you might be using that API key besides just in the bot.
    The code you posted here looks fine, though.
  5. Thanks
    Raminos reacted to SnaBe in [HELP] how to continue?   
    Here's how you can check if an offer you sent has been accepted or declined.
    //When one of our trade offers changes states. manager.on('sentOfferChanged', function(offer, oldState) { //Alert us when an outgoing offer is accepted. if(offer.state == TradeOfferManager.ETradeOfferState.Accepted) { console.log('Our offer #' + offer.id + ' has been accepted.'); client.chatMessage(offer.partner.getSteamID64(), 'Thanks for the trade!'); } else if(offer.state == TradeOfferManager.ETradeOfferState.Declined) { console.log('Our offer #' + offer.id + ' has been declined.'); client.chatMessage(offer.partner.getSteamID64(), 'If you believe there\'s an error with your trade offer, please contact a staff member.'); } });
  6. Thanks
    Raminos reacted to SnaBe in [HELP] how to continue?   
    To add an 'x' amount of keys to the array, just add an extra check in the if statement. (The one inside the for-loop)
    //Loop for(var n = 0; n < inventory.length; n++) { if(theirKeys.length < amountOfKeysToAddVariable && config.csgo.acceptedKeys.indexOf(inventory[n].market_hash_name) >= 0) { theirKeys.push(inventory[n]); console.log(inventory[n].market_hash_name); } } The item ids are stored inside the theirKeys array, adding them to a trade offer is very simple.
    offer.addTheirItems(theirKeys); I hope this helps!
  7. Thanks
    Raminos reacted to SnaBe in [HELP] how to continue?   
    You're very close, here's how I would do it.
    //Load the inventory manager.getUserInventoryContents(steamID, 730, 2, true, function(err, inventory) { if(err) { console.log('Error getting their inventory: ' + err); } else { console.log('Checking if user: ' + steamID + ' has any CS:GO keys we accept.'); for(var n = 0; n < inventory.length; n++) { if(config.csgo.acceptedKeys.indexOf(inventory[n].market_hash_name) >= 0) { console.log(inventory[n].market_hash_name); } } } }); acceptedKeys is an array containing all the current CS:GO keys, you can always remove or add keys to meet your needs.
    "acceptedKeys": [ "Glove Case Key", "Spectrum Case Key", "Gamma 2 Case Key", "Clutch Case Key", "Huntsman Case Key", "Gamma Case Key", "Spectrum 2 Case Key", "Operation Breakout Case Key", "Shadow Case Key", "Chroma 3 Case Key", "Falchion Case Key", "Winter Offensive Case Key", "Revolver Case Key", "Chroma 2 Case Key" ] To store the keys for a possible trade offer, you would have to add them in a new array. Like so: 
    (This should be done within the for-loop)
    //New empty array var theirKeys = []; //Add the keys to our array theirKeys.push(inventory[n]); After that, you can see how many keys the array contains.
    console.log('User has ' + theirKeys.length + ' key(s).'); I would suggest a custom function for easier use.
    function checkKeys(steamID) { //Their keys in a new array var theirKeys = []; //Load the inventory manager.getUserInventoryContents(steamID, 730, 2, true, function(err, inventory) { if(err) { console.log('Error getting their inventory: ' + err); } else { console.log('Checking if user: ' + steamID + ' has CS:GO keys.'); for(var n = 0; n < inventory.length; n++) { if(config.csgo.acceptedKeys.indexOf(inventory[n].market_hash_name) >= 0) { theirKeys.push(inventory[n]); console.log(inventory[n].market_hash_name); } } console.log('User has ' + theirKeys.length + ' key(s).'); } }); } Chat command example:
    client.on('friendMessage', function(steamID, message) { if(message.match('!check')) { client.chatMessage(steamID, 'Handling your request...'); checkKeys(steamID); } else { client.chatMessage(steamID, 'I don\'t know that command.'); } });
×
×
  • Create New...