2
Node.js hltv scorebot(https://github.com/Nols1000/hltv-scorebot)で回ることはできませんが、一致IDを持つhltvサーバーに接続すると、一致するログはありません。それだけで何も価値がない何もログを何もしません、誰もがhltvからのライブデータを取得して、このAPIを除いて、これを行うための別の方法があります。 はここNode.js HLTV scorebotが動作しない
var Scorebot = require('hltv-scorebot');
var io = require('socket.io').listen(8080);
var client = io.sockets;
client.on("connection", function(socket){
console.log("connected");
var match_id = socket.request._query['matchid'];
console.log("match_id is " + match_id);
var sb = new Scorebot();
sb.connect('http://scorebot.hltv.org',10022,478323);
sb.on('kill', function(killer, victim, weapon, headshot, assister) {
console.log("kill event");
console.log(killer, victim, weapon, headshot, assister);
var killerName = killer.name;
// Checking if assister exists
if(assister)
killerName = killer.name + " and " + assister.name;
console.log(killer.name, 'killed', vicitim.name, 'with', weapon, headshot ? 'headshot' : '');
});
sb.on("time", function(time){
/*console.log("time event fired");
console.log(time);*/
socket.emit("msg", {type:"time", args: arguments})
});
sb.on("player", function(playermanager){
console.log("player");
for (var i in playermanager){
console.log(i);
for (var j in playermanager[i]){
console.log(j);
console.log(playermanager[i]);
}
}
socket.emit("msg", {type:"player", args: arguments})
});
sb.on("assist", function(assister, victim){
/*console.log("assist");
console.log(assister, victim);*/
socket.emit("msg", {type:"assist", args: arguments})
});
sb.on("roundend", function(winner, tscore, ctscore){
/*console.log("roundend");
console.log(winner, tscore, ctscore);*/
socket.emit("msg", {type:"roundend", args: arguments})
});
sb.on("playerjoin", function(player){
/*console.log("playerjoin");
console.log(player);*/
socket.emit("msg", {type:"playerjoin", args: arguments})
});
socket.on("ttt", function(){process.exit(1)});
sb.on("playerquit", function(player){
/*console.log("playerquit");
console.log(player);*/
socket.emit("msg", {type:"playerquit", args: arguments})
});
sb.on('bombPlanted', function(bia) {
/*console.log("bombPlanted");
console.log(bia);*/
socket.emit("msg", {type:"bombPlanted", args: arguments})
});
sb.on("roundstart", function(){
/*console.log("Round started");*/
socket.emit("msg", {type:"rountstart", args: arguments})
});
sb.on('score', function(score) {
/*console.log("score");
console.log(score);*/
socket.emit("msg", {type:"score", args: arguments})
});
sb.on('mapchange', function(map) {
socket.emit("msg", {type:"mapChange", args: arguments})
/*console.log("map");
console.log(map);*/
});
});