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 return true
end end
bans.add(cmdClient, clientId, duration, reason)
if settings.get("g_playerHistory") ~= 0 then if settings.get("g_playerHistory") ~= 0 then
history.add(cmdClient, clientId, "ban", reason) history.add(cmdClient, clientId, "ban", reason)
end end
local durationText = "permanently"
if duration then 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\";") durationText = "for "..duration.." seconds"
else
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dban: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9has been banned permanently\";")
end 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 return true
end 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)) 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 return true
end end
admin.kickPlayer(cmdClient, clientId, reason)
if settings.get("g_playerHistory") ~= 0 then if settings.get("g_playerHistory") ~= 0 then
history.add(cmdClient, clientId, "kick", reason) history.add(cmdClient, clientId, "kick", reason)
end 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 return true
end 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)) 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))