Giter VIP home page Giter VIP logo

hltv-scorebot's Introduction

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

hltv-scorebot's People

Contributors

andrewda avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.