This version of hltv-scorebot is much like @Nols1000's original version created back in May of 2015. It is packed full of features, but was never updated to the newest version of HLTV's scorebot. I created this version to be more of a wrapper to HLTV, and to incorporate all of the features available with the new scorebot.
Install with npm:
npm install andrewda/hltv-scorebot
Using HLTV-Scorebot:
var Scorebot = require('hltv-scorebot');
var sb = new Scorebot();
sb.connect(383564, 2299033);
sb.on('kill', function(data) {
console.log(data.killer.name, 'killed', data.victim.name, 'with', data.weapon, data.headshot ? '(headshot)' : '');
});
connect(matchid, listid, url [optional], port [optional], oldtime [optional])
matchid
identifier for the wanted match. andrewda made a module to get the matchid https://github.com/andrewda/hltv-live-gameslistid
secondary identifier for the wanted match. It can be found in the URL immediatly after/match/
or on the HLTV page when the game goes live.- The list id for http://www.hltv.org/match/2298994-maxandrelax-arcade-dngit-2000-weekly-cup-24 would be 2298994.
url
[OPTIONAL] the ip of the scorebot server (defaulthttp://scorebot2.hltv.org
).port
[OPTIONAL] the port of the scorebot server (default10022
).oldtime
[OPTIONAL] if we want to use the old match time (defaultfalse
)
getPlayersOnline()
- returns a list of all players connected
getPlayerByName(name)
on(event, callback)
event
time
callback: function(time) [int]
- updates game clock every second
- freeze timer is experimental
score
callback: function(score) [Object]
score
currentMap
/mapScores
firstHalf
ctTeamDbId
: the id of the CT teamctScore
: the score of the CT team after (or during) the first halftTeamDbId
: the id of the T teamtScore
: the score of the T team after (or during) the first half
secondHalf
ctTeamDbId
: the id of the CT teamctScore
: the score of the CT team after (or during) the second halftTeamDbId
: the id of the T teamtScore
: the score of the T team after (or during) the second half
overtime
ctTeamDbId
: the id of the CT teamctScore
: the score of the CT team after (or during) the overtimetTeamDbId
: the id of the T teamtScore
: the score of the T team after (or during) the overtime
live
: whether the map is being played or notliveLog
: requirements returned by HLTVmap
: the map being playedcurrentCTTeam
: the id of the CT teamcurrentTTeam
: the id of the T teamcurrentCtScore
: the score of the CT teamcurrentTScore
: the score of the T teammapOrdinal
: the map number being played (e.g. Map 2 of a Best of Three)
listid
: the game's listidwins
matchLive
: whether the match is live or not
kill
callback: function(kill) [Object]
kill
killer
- [Player]
victim
- [Player]
weapon
: the weapon usedheadshot
: whether the kill was with a headshot, boolean
bombPlanted
callback: function(player) [Object]
player
- [Player]
bombDefused
callback: function(player) [Object]
player
- [Player]
roundStart
callback: function()
roundEnd
callback: function(end) [Object]
end
score
ct
: the CT scoret
: the T score
winner
: the team that wonwinType
: how the team wonknifeRound
: if we think the round was a knife round (>5 kills)
playerJoin
callback: function(player) [Object]
player
playerName
: the player's name
playerQuit
callback: function(player) [Object]
player
- [Player]
mapChange
callback: function(map) [Object]
map
map
: the new map
restart
callback: function()
To be done