title: Making A CSGO Trade Bot In Node
body: <p>I'm working on a CSGO Trade bot in node.js, It's not really "errors" but more of logic errors. So, my bot is able to accept skins, and do everything as normal, but my timer is looping everytime someone deposits a new skins, and once the timer goes to hit "0" it constantly loops. I think this is the issues where the coding is wrong, but if you guys need more info, i'll be more than glad to add it.</p>
  
  <pre><code>//Vars
  var GameTime = 120;
  var sitename = '142.4.205.65:96'; //you guys can look at the site if you want, the server has ddos protection.
  var botName = '[CSGOSpoils] Bot #1 Dank Memmes';
  var botAdmin = '76561198196029333';
  var botAPIkey;
  var globalSessionID;
  </code></pre>
  
  <p>More </p>
  
  <pre><code>function CheckTimer() {
      if(locked == true) return;
      locked = true;
      if(recheck == true) {
          recheck = false;
          checkoffers(1000);
      }
      mysqlConnection.query('SELECT `value` FROM `info` WHERE `name`=\'current_game\'', function(err, rows, fields) {
          if(err) return;
          mysqlConnection.query('SELECT `starttime` FROM `games` WHERE `id`=\''+rows[0].value+'\'', function(errs, rowss, fieldss) {
              if(errs) return;
              var timeleft;
              if(rowss[0].starttime == 2147483647) timeleft = GameTime;
              else {
                  var unixtime = Math.round(new Date().getTime()/1000.0);
                  timeleft = rowss[0].starttime+GameTime-unixtime;
                  if(timeleft &lt; 0) timeleft = 0;
              }
              if(timeleft == 0) {
                  if(proceeded == true) return;
                  proceedWinners();
                  proceeded = true;
              } else proceeded = false;
          }); 
      });
  </code></pre>
  
  <p>Process winners function</p>
  
  <pre><code>   function proceedWinners() {
          var url = 'http://'+sitename+'/getwinner34634f.php';
          request(url, function(error, response, body){});
      }
  </code></pre>