From b81894db87f70a6a43343a2017b15d37343629a8 Mon Sep 17 00:00:00 2001 From: Timo Smit Date: Mon, 6 Feb 2017 17:50:44 +0100 Subject: [PATCH] Added more info to !finger and readconfig on standalone (refs #62) --- luamods/wolfadmin/commands/admin/finger.lua | 4 +++ .../wolfadmin/commands/admin/readconfig.lua | 25 +++++++++++++++---- luamods/wolfadmin/players/players.lua | 5 ++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/luamods/wolfadmin/commands/admin/finger.lua b/luamods/wolfadmin/commands/admin/finger.lua index 9c5940d..1008050 100644 --- a/luamods/wolfadmin/commands/admin/finger.lua +++ b/luamods/wolfadmin/commands/admin/finger.lua @@ -51,12 +51,16 @@ function commandFinger(clientId, command, victim) ["codedsname"] = players.getName(cmdClient):gsub("%^([^^])", "^^2%1"), ["slot"] = cmdClient, ["guid"] = players.getGUID(cmdClient), + ["ip"] = players.getIP(cmdClient), + ["version"] = players.getVersion(cmdClient) } et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dInformation about ^7"..stats["name"].."^d:\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dName: ^2"..stats["cleanname"].." ("..stats["codedsname"]..")\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dSlot: ^2"..stats["slot"]..(stats["slot"] < tonumber(et.trap_Cvar_Get("sv_privateClients")) and " ^9(private)" or "").."\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dGUID: ^2"..stats["guid"].."\";") + et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dIP: ^2"..stats["ip"].."\";") + et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dVersion: ^2"..stats["version"].."\";") return true end diff --git a/luamods/wolfadmin/commands/admin/readconfig.lua b/luamods/wolfadmin/commands/admin/readconfig.lua index b03b49d..c3bcf85 100644 --- a/luamods/wolfadmin/commands/admin/readconfig.lua +++ b/luamods/wolfadmin/commands/admin/readconfig.lua @@ -15,19 +15,34 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -local auth = require (wolfa_getLuaPath()..".auth.auth") -local settings = require (wolfa_getLuaPath()..".util.settings") -local commands = require (wolfa_getLuaPath()..".commands.commands") local rules = require (wolfa_getLuaPath()..".admin.rules") + +local auth = require (wolfa_getLuaPath()..".auth.auth") + +local commands = require (wolfa_getLuaPath()..".commands.commands") + local greetings = require (wolfa_getLuaPath()..".players.greetings") +local settings = require (wolfa_getLuaPath()..".util.settings") + function commandReadconfig(clientId, command) settings.load() local rulesCount = rules.load() local greetingsCount = greetings.load() - + et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"readconfig: loaded "..greetingsCount.." greetings, "..rulesCount.." rules\";") - + return false end commands.addadmin("readconfig", commandReadconfig, auth.PERM_READCONFIG, "reloads the shrubbot config file and refreshes user flags", nil, true, (settings.get("g_standalone") == 1)) + +function commandReadconfig(clientId, command) + settings.load() + local rulesCount = rules.load() + local greetingsCount = greetings.load() + + et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"readconfig: loaded "..greetingsCount.." greetings, "..rulesCount.." rules\";") + + return false +end +commands.addadmin("readconfig", commandReadconfig, auth.PERM_READCONFIG, "reloads the config file", nil, nil, (settings.get("g_standalone") == 0)) diff --git a/luamods/wolfadmin/players/players.lua b/luamods/wolfadmin/players/players.lua index 9afd97d..96fa12c 100644 --- a/luamods/wolfadmin/players/players.lua +++ b/luamods/wolfadmin/players/players.lua @@ -51,6 +51,10 @@ function players.getIP(clientId) return data[clientId]["ip"] end +function players.getVersion(clientId) + return data[clientId]["version"] +end + function players.isBot(clientId) return data[clientId]["bot"] end @@ -126,6 +130,7 @@ function players.onconnect(clientId, firstTime, isBot) data[clientId]["name"] = et.Info_ValueForKey(clientInfo, "name") data[clientId]["guid"] = et.Info_ValueForKey(clientInfo, "cl_guid") data[clientId]["ip"] = string.gsub(et.Info_ValueForKey(clientInfo, "ip"), ":%d*", "") + data[clientId]["version"] = et.Info_ValueForKey(clientInfo, "cg_etVersion") data[clientId]["bot"] = isBot data[clientId]["team"] = tonumber(et.gentity_get(clientId, "sess.sessionTeam"))