From 127cfa65067cce22dcae2f6bb2285f0315f88a1c Mon Sep 17 00:00:00 2001 From: _FR_Starfox64 Date: Sat, 30 Jan 2016 00:42:53 +0100 Subject: [PATCH] Fixed issue related to a GMod breaking change (util.TableToJSON) --- foxedbot.js/app.js | 18 +++++++++--------- foxedbot.js/package.json | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/foxedbot.js/app.js b/foxedbot.js/app.js index 95805b7..525a591 100644 --- a/foxedbot.js/app.js +++ b/foxedbot.js/app.js @@ -236,10 +236,10 @@ app.server.on("connection", function (sock) { } if (isNaN(sock.serverID)) { // Checks if the socket is authenticated - if (data[1] === "AUTH") { - if (data[2] === Config.serverKey) { - if (Config.servers[data[3]]) { // Checks if the provided serverID exists - sock.serverID = data[3]; + if (data[0] === "AUTH") { + if (data[1] === Config.serverKey) { + if (Config.servers[data[2]]) { // Checks if the provided serverID exists + sock.serverID = data[2]; app.Socks[sock.serverID] = sock; app.logger.info("Server " + sock.serverID + " has been authenticated!"); func.sendToSocket(sock, JSON.stringify(["SYS", "AUTHED"])); @@ -257,14 +257,14 @@ app.server.on("connection", function (sock) { func.sendToSocket(sock, JSON.stringify(["SYS", "DENIED"])); } else { - if (data[1] === "Event") { - if (app.eventEmitter.listeners(data[2]).length > 0) { - app.eventEmitter.emit(data[2], sock.serverID, data[3]) + if (data[0] === "Event") { + if (app.eventEmitter.listeners(data[1]).length > 0) { + app.eventEmitter.emit(data[1], sock.serverID, data[2]) } else { - app.logger.warn(sock.remoteAddress + " tried to trigger an unknown event! (" + data[2] + ")"); + app.logger.warn(sock.remoteAddress + " tried to trigger an unknown event! (" + data[1] + ")"); } } else { - app.sendMessage(data[3], data[4]); + app.sendMessage(data[2], data[3]); } } }); diff --git a/foxedbot.js/package.json b/foxedbot.js/package.json index bf829a0..d660c9e 100644 --- a/foxedbot.js/package.json +++ b/foxedbot.js/package.json @@ -1,6 +1,6 @@ { "name": "foxedbot", - "version": "2.0.1", + "version": "3.0.0", "description": "A SteamBot for Garry's Mod.", "main": "./app.js", "repository": {