Jump to content
McKay Development

McMuffinDK

Member
  • Posts

    49
  • Joined

  • Last visited

Everything posted by McMuffinDK

  1. Sorry, i do not know anything about that
  2. Ah sorry, didn't realize it was for TF2. Try change the appid to 440: opskins.getPriceList(440, ( (err, prices) =>
  3. This is the code i use at the moment "use strict"; const OPSkinsAPI = require('@opskins/api'); const opskins = new OPSkinsAPI(Your OPSkins API); const mysql = require('mysql'); var con = mysql.createConnection({ // Your MySQL connection details host: '', user: '', password: '', database: '' }); con.connect( (err) => { if (err) { throw err; } else { console.log('MySQL connected'); } }); setInterval( () => { if (new Date().getHours() === 22) { opskins.getPriceList(730, ( (err, prices) => { if (err) { console.log(err); } else { var names = Object.getOwnPropertyNames(prices); for (var i = 0; i <= names.length; i++) { var n; setTimeout( (i) => { if (i < names.length) { var name = '"' + names[i] + '"'; var named = names[i]; var date = Object.getOwnPropertyNames(prices[named]); var price = prices[named][date[0]].price; var sql = "INSERT INTO pricing(name, price) VALUES(" + name + ", " + price + ") ON DUPLICATE KEY UPDATE price = " + price + ";"; con.query(sql, (err) => { if (err) { throw err; } else { n = i + 1; console.log('Updating prices.. ' + n + '/' + names.length); if (n === names.length) { console.log('Prices updated'); } } }); } }, 10 * i, i); } } })); } }, 3600000);
  4. You can put a function that does something with the callback Price.getPrice(tag, craft, itemName, (price, priceType) => { console.log("Price: " + price); console.log("Price Type: " + priceType) }); tag : A string that includes your tag like "Vintage","Unique" and "Vintage" craft: A string that includes your craft type like "Craftable" or "Non-Craftable" itemName: A string that includes your items full name on BP.TF like "Taunt: Kazotsky Kick" price: Price of item. priceType: Type of price. Returns "key" or "ref" I would like to recommend the OPSkins API for your pricing as you need less calls and you are not depending on another service to be online as you can save all the prices in a database or file. If you want i can provide an example code for this too
  5. What is the other file? Is it javascript? A text document? What is the file used for?
  6. If your function is processOffer() you can do this: function processOffer(offer) { // do something with offer } manager.on('newOffer', (offer) => { processOffer(offer); }
  7. Thanks for the answer! Can you provide an example for clarification?
  8. I think an environment variable would be best, but honestly i don't know
  9. My node js app are limited to it's own folder so i need to have the files in that folder
  10. As the title says, i want to change the default path of the certificate and key files. Is this posible?
  11. I got some questions: 1. Should i update the cookies? 2. When should i do it? 3. How can i do it?
  12. I would recommend PHP on the server-side and JavaScript on the client-side. You can learn the languages here. Then you can try make what you think fits your needs the most
  13. Your offer is sent before the console.log because nodeJS is async
  14. Can you please post your solution so that someone else may learn from this?
  15. When i send a trade offer i want to know when and if it is accepted or declined. Is this possible and how?
  16. It looks like your server runs out of memory, try make your swapfile bigger https://askubuntu.com/questions/178712/how-to-increase-swap-space
  17. I have this code to get the items of a specific user, but it should work for every user in the world, so i want to use a variable instead of hardcoding the steamID64 into it, but i just can't get it to work var qqdata = steamID64; // the steamid64 of the user i want to get the inventory from const offer = manager.createOffer + qqdata; offer.getPartnerInventoryContents(730, 2, (err, inventory) => { if (err) { console.log(err); } else { for (var i = 0; i < inventory.length; i++) { setTimeout(function (i) { var name = "'" + inventory[i].market_hash_name + "'"; var image = "'" + inventory[i].icon_url + "'"; var sql = "INSERT INTO `inventorys`.`" + qqdata + "` (name, icon_url) VALUES (" + name + ", " + image + ")"; con.query(sql, function (err) { if (err) { console.log(err); } }); }, 10 * i, i); } } });
×
×
  • Create New...