Replaced g_warnHistory with g_playerHistory and added possibility to disable history (refs #55)

This commit is contained in:
Timo Smit 2017-02-01 17:31:09 +01:00
parent 329eb3afc7
commit 891a91fdf1
6 changed files with 21 additions and 17 deletions

View file

@ -20,9 +20,9 @@ set g_restrictedVotes ""
set g_renameLimit 3 set g_renameLimit 3
set g_renameInterval 60 set g_renameInterval 60
set g_playerHistory 1
set g_spreeRecords 1 set g_spreeRecords 1
set g_botRecords 1 set g_botRecords 1
set g_warnHistory 1
set g_announceRevives 1 set g_announceRevives 1

View file

@ -73,7 +73,10 @@ function commandBan(clientId, command, victim, ...)
end end
bans.add(cmdClient, clientId, duration, reason) bans.add(cmdClient, clientId, duration, reason)
history.add(cmdClient, clientId, "ban", reason)
if settings.get("g_playerHistory") ~= 0 then
history.add(cmdClient, clientId, "ban", reason)
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dban: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been banned for "..duration.." seconds\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dban: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been banned for "..duration.." seconds\";")

View file

@ -58,7 +58,10 @@ function commandKick(clientId, command, victim, ...)
local reason = table.concat({...}, " ") local reason = table.concat({...}, " ")
admin.kickPlayer(cmdClient, clientId, reason) admin.kickPlayer(cmdClient, clientId, reason)
history.add(cmdClient, clientId, "kick", reason)
if settings.get("g_playerHistory") ~= 0 then
history.add(cmdClient, clientId, "kick", reason)
end
return true return true
end end

View file

@ -28,8 +28,8 @@ local pagination = require (wolfa_getLuaPath()..".util.pagination")
local settings = require (wolfa_getLuaPath()..".util.settings") local settings = require (wolfa_getLuaPath()..".util.settings")
function commandListHistory(clientId, command, victim, offset) function commandListHistory(clientId, command, victim, offset)
if settings.get("g_standalone") == 0 or not db.isconnected() then if not db.isconnected() or settings.get("g_playerHistory") == 0 then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dshowhistory: ^9warn history is disabled.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dshowhistory: ^9player history is disabled.\";")
return true return true
elseif victim == nil then elseif victim == nil then
@ -70,4 +70,4 @@ function commandListHistory(clientId, command, victim, offset)
return true return true
end end
commands.addadmin("showhistory", commandListHistory, auth.PERM_LISTHISTORY, "display history for a specific player", "^9[^3name|slot#^9] ^9(^hoffset^9)", nil, (settings.get("g_standalone") == 0)) commands.addadmin("showhistory", commandListHistory, auth.PERM_LISTHISTORY, "display history for a specific player", "^9[^3name|slot#^9] ^9(^hoffset^9)", (settings.get("g_playerHistory") == 0))

View file

@ -17,7 +17,6 @@
local auth = require (wolfa_getLuaPath()..".auth.auth") local auth = require (wolfa_getLuaPath()..".auth.auth")
local admin = require (wolfa_getLuaPath()..".admin.admin")
local history = require (wolfa_getLuaPath()..".admin.history") local history = require (wolfa_getLuaPath()..".admin.history")
local db = require (wolfa_getLuaPath()..".db.db") local db = require (wolfa_getLuaPath()..".db.db")
@ -29,7 +28,7 @@ local players = require (wolfa_getLuaPath()..".players.players")
local settings = require (wolfa_getLuaPath()..".util.settings") local settings = require (wolfa_getLuaPath()..".util.settings")
function commandWarn(clientId, command, victim, ...) function commandWarn(clientId, command, victim, ...)
if settings.get("g_warnHistory") == 0 or not db.isconnected() then if not db.isconnected() or settings.get("g_playerHistory") == 0 then
return false return false
elseif not victim or not ... then elseif not victim or not ... then
return false return false
@ -49,7 +48,7 @@ function commandWarn(clientId, command, victim, ...)
return false return false
end end
commands.addadmin("warn", commandWarn, auth.PERM_WARN, "warns a player by displaying the reason", "^9[^3name|slot#^9] ^9[^3reason^9]", true, (settings.get("g_standalone") == 1)) commands.addadmin("warn", commandWarn, auth.PERM_WARN, "warns a player by displaying the reason", "^9[^3name|slot#^9] ^9[^3reason^9]", true, (settings.get("g_standalone") == 1 or settings.get("g_playerHistory") == 0))
function commandWarn(clientId, command, victim, ...) function commandWarn(clientId, command, victim, ...)
if not victim or not ... then if not victim or not ... then
@ -80,7 +79,9 @@ function commandWarn(clientId, command, victim, ...)
local reason = table.concat({...}, " ") local reason = table.concat({...}, " ")
history.add(cmdClient, clientId, "warn", reason) if settings.get("g_playerHistory") ~= 0 then
history.add(cmdClient, clientId, "warn", reason)
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "ccp "..cmdClient.." \"^7You have been warned by "..players.getName(clientId)..": ^7"..reason..".\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "ccp "..cmdClient.." \"^7You have been warned by "..players.getName(clientId)..": ^7"..reason..".\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay -1 \"^dwarn: ^7"..players.getName(cmdClient).." ^9has been warned.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay -1 \"^dwarn: ^7"..players.getName(cmdClient).." ^9has been warned.\";")

View file

@ -15,7 +15,6 @@
-- 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 util = require (wolfa_getLuaPath()..".util.util")
local events = require (wolfa_getLuaPath()..".util.events") local events = require (wolfa_getLuaPath()..".util.events")
local settings = {} local settings = {}
@ -25,14 +24,12 @@ local data = {
["g_logAdmin"] = "admin.log", ["g_logAdmin"] = "admin.log",
["g_fileGreetings"] = "greetings.cfg", ["g_fileGreetings"] = "greetings.cfg",
["g_fileRules"] = "rules.cfg", ["g_fileRules"] = "rules.cfg",
["g_fileSprees"] = "sprees.cfg", ["g_playerHistory"] = 1,
["g_jukeboxEnabled"] = 0,
["g_spreeRecords"] = 1, ["g_spreeRecords"] = 1,
["g_warnHistory"] = 1, ["g_botRecords"] = 1,
["g_announceRevives"] = 1, ["g_announceRevives"] = 1,
["g_greetingArea"] = 3, ["g_greetingArea"] = 3,
["g_botGreetings"] = 1, ["g_botGreetings"] = 1,
["g_botRecords"] = 1,
["g_welcomeMessage"] = "^dwolfadmin: ^9This server is running WolfAdmin, type ^7/wolfadmin ^9for more information.", ["g_welcomeMessage"] = "^dwolfadmin: ^9This server is running WolfAdmin, type ^7/wolfadmin ^9for more information.",
["g_welcomeArea"] = 3, ["g_welcomeArea"] = 3,
["g_evenerMinDifference"] = 2, ["g_evenerMinDifference"] = 2,