Skip to content

gitter-badger/hltv-scorebot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 

Repository files navigation

HLTV Scorebot

Codacy Badge

Introduction

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.

Getting started

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)' : '');
});

Methods

  • connect(matchid, listid, url [optional], port [optional], oldtime [optional])
  • 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 team
              • ctScore: the score of the CT team after (or during) the first half
              • tTeamDbId: the id of the T team
              • tScore: the score of the T team after (or during) the first half
            • secondHalf
              • ctTeamDbId: the id of the CT team
              • ctScore: the score of the CT team after (or during) the second half
              • tTeamDbId: the id of the T team
              • tScore: the score of the T team after (or during) the second half
            • overtime
              • ctTeamDbId: the id of the CT team
              • ctScore: the score of the CT team after (or during) the overtime
              • tTeamDbId: the id of the T team
              • tScore: the score of the T team after (or during) the overtime
            • live: whether the map is being played or not
            • liveLog: requirements returned by HLTV
            • map: the map being played
            • currentCTTeam: the id of the CT team
            • currentTTeam: the id of the T team
            • currentCtScore: the score of the CT team
            • currentTScore: the score of the T team
            • mapOrdinal: the map number being played (e.g. Map 2 of a Best of Three)
          • listid: the game's listid
          • wins
          • matchLive: whether the match is live or not
      • kill
        • callback: function(kill) [Object]
        • kill
          • killer
            • [Player]
          • victim
            • [Player]
          • weapon: the weapon used
          • headshot: 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 score
            • t: the T score
          • winner: the team that won
          • winType: how the team won
          • knifeRound: 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()

Examples

To be done

About

A wrapper for the HLTV scorebot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%