Nols1000 / hltv-scorebot

Node.js implementation of the HLTV.ORG-Scorebot.
http://nols1000.github.io/hltv-scorebot
23 stars 8 forks source link

[Suggestion] Add example #1

Closed andrewda closed 9 years ago

andrewda commented 9 years ago

I'm a bit confused with how to use it, but I'm sure I'll get it if you could please make a simple example program! Thanks!

Nols1000 commented 9 years ago

hltv-scorebot is a event driven node module.

First you have to get the module by using

var scorebot = require('hltv-scorebot');

After this you have to connect to the hltv-scorebot-server by using

scorebot.connect('http://scorebot.hltv.org:10022', matchid, socketEvent);

To register a EventListener use

scorebot.on(eventName, function(data) {
   console.log(data);
});

Get the eventName-List and eventData from ReadMe.md e.g

scorebot.on('kill', function(data) {
   console.log(data.agressor, 'killed', data.victim, 'with', data.weapon, data.headshot ?  "(headshot)" : "");
});

I dont tested, but it should work.

I'll add examples as soon as possible.

andrewda commented 9 years ago

Incredible explanation -- thanks a ton!