Fixed chat feedback for kick and ban commands

This commit is contained in:
Timo Smit 2019-02-04 12:21:01 +01:00
parent f835d8c6ec
commit d00d30b2ba
2 changed files with 11 additions and 7 deletions

View file

@ -78,18 +78,20 @@ function commandBan(clientId, command, victim, ...)
return true
end
bans.add(cmdClient, clientId, duration, reason)
if settings.get("g_playerHistory") ~= 0 then
history.add(cmdClient, clientId, "ban", reason)
end
local durationText = "permanently"
if duration then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dban: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been banned for "..duration.." seconds\";")
else
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dban: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been banned permanently\";")
durationText = "for "..duration.." seconds"
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dban: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been banned "..durationText.."\";")
bans.add(cmdClient, clientId, duration, reason)
return true
end
commands.addadmin("ban", commandBan, auth.PERM_BAN, "ban a player with an optional duration and reason", "^9[^3name|slot#^9] ^9(^3duration^9) ^9(^3reason^9)", nil, (settings.get("g_standalone") == 0))

View file

@ -70,12 +70,14 @@ function commandKick(clientId, command, victim, ...)
return true
end
admin.kickPlayer(cmdClient, clientId, reason)
if settings.get("g_playerHistory") ~= 0 then
history.add(cmdClient, clientId, "kick", reason)
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dkick: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been kicked\";")
admin.kickPlayer(cmdClient, clientId, reason)
return true
end
commands.addadmin("kick", commandKick, auth.PERM_KICK, "kick a player with an optional reason", "^9[^3name|slot#^9] ^9(^3reason^9)", nil, (settings.get("g_standalone") == 0))