mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-09-30 06:01:32 +02:00
Add support for cs:go servers with host_players_show 1
This commit is contained in:
parent
bc39f699c1
commit
a483a17e6f
@ -145,22 +145,29 @@ module.exports = require('./core').extend({
|
|||||||
self.sendPacket(0x55,true,false,0x44,function(b) {
|
self.sendPacket(0x55,true,false,0x44,function(b) {
|
||||||
var reader = self.reader(b);
|
var reader = self.reader(b);
|
||||||
var num = reader.uint(1);
|
var num = reader.uint(1);
|
||||||
|
var csgoHiddenPlayers = false;
|
||||||
for(var i = 0; i < num; i++) {
|
for(var i = 0; i < num; i++) {
|
||||||
reader.skip(1);
|
reader.skip(1);
|
||||||
var name = reader.string();
|
var name = reader.string();
|
||||||
var score = reader.int(4);
|
var score = reader.int(4);
|
||||||
var time = reader.float();
|
var time = reader.float();
|
||||||
|
|
||||||
|
if(self.debug) console.log("Found player: "+name+" "+score+" "+time);
|
||||||
|
|
||||||
// connecting players don't count as players.
|
// connecting players don't count as players.
|
||||||
if(!name) continue;
|
if(!name) continue;
|
||||||
|
|
||||||
if(self.isCsGo && name === 'Max Players') continue;
|
|
||||||
|
|
||||||
(time == -1 ? state.bots : state.players).push({
|
(time == -1 ? state.bots : state.players).push({
|
||||||
name:name, score:score, time:time
|
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
|
// if we didn't find the bots, iterate
|
||||||
// through and guess which ones they are
|
// through and guess which ones they are
|
||||||
if(!state.bots.length && state.raw.numbots) {
|
if(!state.bots.length && state.raw.numbots) {
|
||||||
|
Loading…
Reference in New Issue
Block a user