From 5982d0440ecc19f8084710efc573cf4d08d81bb4 Mon Sep 17 00:00:00 2001 From: Chris Holman Date: Fri, 15 Nov 2013 22:17:43 +1100 Subject: [PATCH] Fixed example and readme to reflect how the library actually works --- example.js | 15 ++++++++------- readme.md | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/example.js b/example.js index 8d0c75d..9d7f957 100644 --- a/example.js +++ b/example.js @@ -1,15 +1,16 @@ var srcds = require('./main.js'); -srcds.init(); -srcds.client.on('decoded', function(info) { - console.log(info); - srcds.client.close(); -}); // If the example isn't working, it might just be that the server it's trying to query is down. You can cross check that here: // http://www.gametracker.com/server_info/203.217.24.85:27017/ // If it is down, find one that isn't and change the IP and port accordingly -srcds.info('203.217.24.85', 27017, function(err) { - if (err) console.error(err) +var client = srcds("27.50.71.3", 21035); + + +client.info(function(err, res) { + if (err) console.error(err); + console.log("Queried server at " + res.ip + ":" + res.port + + ". Its name is '" + res.serverName + "' and it has " + + res.numPlayers + " people currently playing."); }); diff --git a/readme.md b/readme.md index 6ef7b78..3cda909 100644 --- a/readme.md +++ b/readme.md @@ -21,7 +21,7 @@ var srcds = require('srcds-info'); client = srcds('27.50.71.3', 21045); -client.info('203.217.24.85', 27017, function(err, info) { +client.info(function(err, info) { if (err) { console.error(err) }