Fixed !stats command on legacymod (refs #46)

This commit is contained in:
Timo Smit 2017-01-21 18:04:31 +01:00
parent 3231ea6c74
commit 04c78f0886

View file

@ -16,9 +16,11 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = require (wolfa_getLuaPath()..".auth.auth")
local util = require (wolfa_getLuaPath()..".util.util")
local commands = require (wolfa_getLuaPath()..".commands.commands")
local util = require (wolfa_getLuaPath()..".util.util")
function commandShowStats(clientId, cmdArguments)
if cmdArguments[1] == nil then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dstats usage: "..commands.getadmin("stats")["syntax"].."\";")
@ -53,13 +55,21 @@ function commandShowStats(clientId, cmdArguments)
["totalkills"] = et.gentity_get(cmdClient, "sess.kills") + et.gentity_get(cmdClient, "sess.team_kills"),
["damage"] = et.gentity_get(cmdClient, "sess.damage_given"),
["damagereceived"] = et.gentity_get(cmdClient, "sess.damage_received"),
["teamdamage"] = et.gentity_get(cmdClient, "sess.team_damage"),
-- ["teamdamagereceived"] = et.gentity_get(cmdClient, "sess.team_received"), -- ETPro only
["totaldamage"] = et.gentity_get(cmdClient, "sess.damage_given") + et.gentity_get(cmdClient, "sess.team_damage"),
["deaths"] = et.gentity_get(cmdClient, "sess.deaths"),
["suicides"] = et.gentity_get(cmdClient, "sess.suicides")
["deaths"] = et.gentity_get(cmdClient, "sess.deaths")
}
if et.trap_Cvar_Get("fs_game") == "legacy" then
stats["teamdamage"] = et.gentity_get(cmdClient, "sess.team_damage_given")
stats["totaldamage"] = et.gentity_get(cmdClient, "sess.damage_given") + et.gentity_get(cmdClient, "sess.team_damage_given")
stats["suicides"] = et.gentity_get(cmdClient, "sess.self_kills")
elseif settings.get("fs_game") == "etpro" then
stats["teamdamagereceived"] = et.gentity_get(cmdClient, "sess.team_received") -- ETPro only
else
stats["teamdamage"] = et.gentity_get(cmdClient, "sess.team_damage")
stats["totaldamage"] = et.gentity_get(cmdClient, "sess.damage_given") + et.gentity_get(cmdClient, "sess.team_damage")
stats["suicides"] = et.gentity_get(cmdClient, "sess.suicides")
end
if stats["totalkills"] == 0 then stats["totalkills"] = 1 end
if stats["totaldamage"] == 0 then stats["totaldamage"] = 1 end