Get the module with the npm:
npm install hltv-scorebot
Install manually:
- Download the latest build of the module at Releases.
- Extract the package and copy it to your projects
node_modules-folder - Rename the module-folder (e.g.
hltv-scorebot-0.1.4) tohltv-scorebot - Execute your console in the module-folder (
hltv-scorebot) - Execute
npm install(This should download and install all dependencies [currently only[email protected]. Check outpackage.json])
Using HLTV-Scorebot:
var Scorebot = require('hltv-scorebot');
var sb = new Scorebot();
sb.connect('http://scorebot.hltv.org', 10023, 36747) // Match 36747 was CLG vs eBettle at ESL One Cologne 2015
// Check out the helper-branch for example data
sb.on('kill', function(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' : '');
});- Team
TERRORIST = 0COUNTERTERRORIST = 1
connect(url, port, matchid)urlthe ip of the scorebot server (def.http://scorebot.hltv.org).portthe port of the scorebot server (def.10023).matchididentifier for your wanted match. andrewda made a module to get the matchid https://github.com/andrewda/hltv-live-games
on(event, callback)eventtimecallback: function(time) [int]- updates game clock every second
- freeze timer is experimental
scorecallback: function(tscore, ctscore) [int, int]- updates score every round after
roundend
playercallback: function(playermanager) [PlayerManager]- updates playermanager every time a player is updated
killcallback: function(killer, victim, weapon, headshot, assister) [Player, Player, String, boolean, Player]- triggers callback when
killerkillsvictimwithweapon - assister is optional
assistcallback: function(assister, victim) [Player, Player]- triggers callback when
assisterassists in a kill ofvictim
bombplantedcallback: function(planter) [Player]- triggers callback when bomb is planted
bombdefusedcallback: function(defuser) [Player]- triggers callback when bomb is defused
roundstartcallback: function()- triggers callback when round starts
roundendcallback: function(winner, tscore, ctscore) [int, int, int]- triggers callback when round ends
winner0 | 1 (0 - T | 1 - CT)
playerjoincallback: function(player) [Player]- triggers callback when a player joins the server
playerquitcallback: function(player) [Player]- triggers callback when a player leaves the server
mapchangecallback: function(map) [String]- triggers callback when the server changes map
restartcallback: function()- triggers callback when server restarts
Scorebot.Playerid [int]steamID [String]name [String]team [int]kills [int]assists [int]deaths [int]alive [boolean]
Scorebot.HLTVPlayername [String]team [int]kills [int]deaths [int]alive [boolean]
Scorebot.KPlayerid [int]steamID [String]name [String]team [int]
Scorebot.APlayerid [int]name [String]team [int]- NODE: Assist will be counted when merge with
Player
Scorebot.PlayerManagerTERRORIST [int]- 0
COUNTERTERRORIST [int]- 1
playerList[team][index] [Array]- 2 dimensional array
- stores all players
set(team, player) [function]- append/update player
playerin teamteam
- append/update player
get(team, index) [function]- returns the player in team
teamatindex
- returns the player in team
getIndex(name) [function]- returns object with team and index of the player with the name
name - return:
{ 'team': 0, 'index': 0 } - returns
{ 'team': -1, 'index': -1 }if there is no player with the namename
- returns object with team and index of the player with the name
getByName(name) [function]- returns player with the name
name
- returns player with the name
getByNameAsync(name, callback) [function]- calls the callback with player with the name
nameas argument - callback:
function(error, player)
- calls the callback with player with the name
del(name) [function]- deletes player with the name
name
- deletes player with the name
- Assists counter wont reset after warm-up
To be done
(Try the examples Folder at the hltv-scorebot repository)
I'm sorry for my poor English. If you have some problems understanding the module, the README or my documentation please mail me (nilsmargotti [at] gmail [dot] com).
Every Feedback is welcome.
Nils 'Nols1000' Margotti