Updated !finger command

* added level and level name
* version removed, since it is not sent by Legacy clients
This commit is contained in:
Timo Smit 2019-02-11 15:06:10 +01:00
parent 2e2c471d98
commit a660a13876
2 changed files with 15 additions and 21 deletions

View File

@ -22,6 +22,7 @@ local commands = wolfa_requireModule("commands.commands")
local players = wolfa_requireModule("players.players")
local settings = wolfa_requireModule("util.settings")
local util = wolfa_requireModule("util.util")
function commandFinger(clientId, command, victim)
local cmdClient
@ -46,22 +47,21 @@ function commandFinger(clientId, command, victim)
return true
end
local stats = {
["name"] = players.getName(cmdClient),
["cleanname"] = players.getName(cmdClient):gsub("%^[^^]", ""),
["codedsname"] = players.getName(cmdClient):gsub("%^([^^])", "^^2%1"),
["slot"] = cmdClient,
["guid"] = players.getGUID(cmdClient),
["ip"] = players.getIP(cmdClient),
["version"] = players.getVersion(cmdClient)
}
local name = players.getName(cmdClient)
local cleanname = util.removeColors(players.getName(cmdClient))
local codedname = players.getName(cmdClient):gsub("%^([^^])", "^^2%1")
local slot = cmdClient
local level = auth.getPlayerLevel(cmdClient)
local levelName = util.removeColors(auth.getLevelName(level))
local guid = players.getGUID(cmdClient)
local ip = players.getIP(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"].."\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dInformation about ^7"..name.."^d:\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dName: ^2"..cleanname.." ("..codedname..")\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dSlot: ^2"..slot..(slot < tonumber(et.trap_Cvar_Get("sv_privateClients")) and " ^9(private)" or "").."\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dLevel: ^2"..level.." ("..levelName..")\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dGUID: ^2"..guid.."\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dIP: ^2"..ip.."\";")
return true
end

View File

@ -51,10 +51,6 @@ function players.getProtocol(clientId)
return data[clientId]["protocol"]
end
function players.getVersion(clientId)
return data[clientId]["version"]
end
function players.isBot(clientId)
return data[clientId]["bot"]
end
@ -162,8 +158,6 @@ function players.onClientBegin(clientId)
-- this is now available
local clientInfo = et.trap_GetUserinfo(clientId)
data[clientId]["version"] = et.Info_ValueForKey(clientInfo, "cg_etVersion")
end
events.handle("onClientBegin", players.onClientBegin)