Added more info to !finger and readconfig on standalone (refs #62)

This commit is contained in:
Timo Smit 2017-02-06 17:50:44 +01:00
parent 2d2e64ea2b
commit b81894db87
3 changed files with 29 additions and 5 deletions

View file

@ -51,12 +51,16 @@ function commandFinger(clientId, command, victim)
["codedsname"] = players.getName(cmdClient):gsub("%^([^^])", "^^2%1"), ["codedsname"] = players.getName(cmdClient):gsub("%^([^^])", "^^2%1"),
["slot"] = cmdClient, ["slot"] = cmdClient,
["guid"] = players.getGUID(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.." \"^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.." \"^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.." \"^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.." \"^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 return true
end end

View file

@ -15,12 +15,16 @@
-- You should have received a copy of the GNU General Public License -- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>. -- along with this program. If not, see <http://www.gnu.org/licenses/>.
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 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 greetings = require (wolfa_getLuaPath()..".players.greetings")
local settings = require (wolfa_getLuaPath()..".util.settings")
function commandReadconfig(clientId, command) function commandReadconfig(clientId, command)
settings.load() settings.load()
local rulesCount = rules.load() local rulesCount = rules.load()
@ -31,3 +35,14 @@ function commandReadconfig(clientId, command)
return false return false
end end
commands.addadmin("readconfig", commandReadconfig, auth.PERM_READCONFIG, "reloads the shrubbot config file and refreshes user flags", nil, true, (settings.get("g_standalone") == 1)) 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))

View file

@ -51,6 +51,10 @@ function players.getIP(clientId)
return data[clientId]["ip"] return data[clientId]["ip"]
end end
function players.getVersion(clientId)
return data[clientId]["version"]
end
function players.isBot(clientId) function players.isBot(clientId)
return data[clientId]["bot"] return data[clientId]["bot"]
end end
@ -126,6 +130,7 @@ function players.onconnect(clientId, firstTime, isBot)
data[clientId]["name"] = et.Info_ValueForKey(clientInfo, "name") data[clientId]["name"] = et.Info_ValueForKey(clientInfo, "name")
data[clientId]["guid"] = et.Info_ValueForKey(clientInfo, "cl_guid") data[clientId]["guid"] = et.Info_ValueForKey(clientInfo, "cl_guid")
data[clientId]["ip"] = string.gsub(et.Info_ValueForKey(clientInfo, "ip"), ":%d*", "") 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]["bot"] = isBot
data[clientId]["team"] = tonumber(et.gentity_get(clientId, "sess.sessionTeam")) data[clientId]["team"] = tonumber(et.gentity_get(clientId, "sess.sessionTeam"))