node-rcon icon indicating copy to clipboard operation
node-rcon copied to clipboard

Waiting for Auth event

Open ZariZaryab opened this issue 2 years ago • 5 comments

var options = {
  tcp: false,
udp: true,       // false for UDP, true for TCP (default true)
  challenge: false  // true to use the challenge protocol (default true)
};

var conn = new Rcon('13.127.42.200', 28961, 'rcon',options);

conn.on('auth', function() {
  // You must wait until this event is fired before sending any commands,
  // otherwise those commands will fail.
  console.log("Authenticated");
  console.log("Sending command: help")
  conn.send("help");
}).on('response', function(str) {
  console.log("Response: " + str);
}).on('error', function(err) {
  console.log("Error: " + err);
}).on('end', function() {
  console.log("Connection closed");
  process.exit();
});

conn.connect();
conn.send("map mp_powcamp")

This doesn't work for some reasons, what to do?

ZariZaryab avatar Sep 29 '21 02:09 ZariZaryab