From a483a17e6fe71b684c1512941977e9d5b23b3d7f Mon Sep 17 00:00:00 2001 From: Michael Morrison Date: Wed, 29 Oct 2014 00:59:45 -0500 Subject: [PATCH] Add support for cs:go servers with host_players_show 1 --- protocols/valve.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/protocols/valve.js b/protocols/valve.js index 0d91738..4fe6f65 100644 --- a/protocols/valve.js +++ b/protocols/valve.js @@ -145,21 +145,28 @@ module.exports = require('./core').extend({ self.sendPacket(0x55,true,false,0x44,function(b) { var reader = self.reader(b); var num = reader.uint(1); + var csgoHiddenPlayers = false; for(var i = 0; i < num; i++) { reader.skip(1); var name = reader.string(); var score = reader.int(4); var time = reader.float(); + if(self.debug) console.log("Found player: "+name+" "+score+" "+time); + // connecting players don't count as players. if(!name) continue; - - if(self.isCsGo && name === 'Max Players') continue; (time == -1 ? state.bots : state.players).push({ name:name, score:score, time:time }); } + + if(self.isCsGo && state.players.length == 1 && state.players[0].name == 'Max Players') { + if(self.debug) console.log("CSGO server using limited player details"); + state.players = []; + for(var i = 0; i < state.raw.numplayers; i++) { state.players.push({}); } + } // if we didn't find the bots, iterate // through and guess which ones they are