Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions example.js
Original file line number Diff line number Diff line change
@@ -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.");
});
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down