mirror of
https://github.com/etlegacy/wolfadmin.git
synced 2025-04-16 13:51:59 +00:00
Added more info to !finger and readconfig on standalone (refs #62)
This commit is contained in:
parent
2d2e64ea2b
commit
b81894db87
3 changed files with 29 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -15,19 +15,34 @@
|
|||
-- You should have received a copy of the GNU General Public License
|
||||
-- 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 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))
|
||||
|
|
|
@ -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"))
|
||||
|
||||
|
|
Loading…
Reference in a new issue