A few edits to warning system

This commit is contained in:
Cooldude2606
2018-01-23 18:39:53 +00:00
parent e26daf8d2f
commit 98bf1bb3c1
2 changed files with 8 additions and 5 deletions

View File

@@ -15,6 +15,7 @@ Event.register(defines.events.on_console_command,function(event)
local data = {} local data = {}
data.title = string.gsub(command,'^%l',string.upper) data.title = string.gsub(command,'^%l',string.upper)
data.by = event.player_index and game.players[event.player_index].name or '<server>' data.by = event.player_index and game.players[event.player_index].name or '<server>'
if data.by == '<server>' then return end
if command == 'config' or command == 'banlist' then if command == 'config' or command == 'banlist' then
discord_emit{ discord_emit{
title='Edit To '..data.title, title='Edit To '..data.title,
@@ -28,7 +29,7 @@ Event.register(defines.events.on_console_command,function(event)
data.colour = Color.to_hex(defines.text_color.crit) data.colour = Color.to_hex(defines.text_color.crit)
data.reason = table.concat(args,' ',2) data.reason = table.concat(args,' ',2)
elseif command == 'kick' then elseif command == 'kick' then
data.colour = Color.to_hex(defines.text_color.med) data.colour = Color.to_hex(defines.text_color.high)
data.reason = table.concat(args,' ',2) data.reason = table.concat(args,' ',2)
elseif command == 'unban' then data.colour = Color.to_hex(defines.text_color.low) elseif command == 'unban' then data.colour = Color.to_hex(defines.text_color.low)
elseif command == 'mute' then data.colour = Color.to_hex(defines.text_color.med) elseif command == 'mute' then data.colour = Color.to_hex(defines.text_color.med)

View File

@@ -121,13 +121,13 @@ local function give_punishment(player,by_player,reason)
report_message(player,'<server>',reason) report_message(player,'<server>',reason)
elseif punishment[1] == 'kick' then elseif punishment[1] == 'kick' then
_reports().actions[player.name] = actions.kick _reports().actions[player.name] = actions.kick
Admin.kick(player,by_player,'Too Many Warnings: '..warnings-(take_action-2)..' Also: '..reason) Admin.kick(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason)
elseif punishment[1] == 'temp-ban' then elseif punishment[1] == 'temp-ban' then
_reports().actions[player.name] = actions.temp _reports().actions[player.name] = actions.temp
Admin.temp_ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-2)..' Also: '..reason) Admin.temp_ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason)
elseif punishment[1] == 'ban' then elseif punishment[1] == 'ban' then
_reports().actions[player.name] = actions.ban _reports().actions[player.name] = actions.ban
Admin.ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-2)..' Also: '..reason) Admin.ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason)
end end
end end
@@ -256,7 +256,9 @@ Event.register(defines.events.on_tick,function(event)
local time_to_remove = _reports().remove_warnings_time[rank.power] local time_to_remove = _reports().remove_warnings_time[rank.power]
if (game.tick % time_to_remove) == 0 then if (game.tick % time_to_remove) == 0 then
_reports().warnings[name]=warnings-1 _reports().warnings[name]=warnings-1
player_return({'reports.remove-warn',_reports().warnings[name],tick_to_display_format(time_to_remove)},defines.text_color.low,name) if _reports().warnings[name] > 5 then
player_return({'reports.remove-warn',_reports().warnings[name],tick_to_display_format(time_to_remove)},defines.text_color.low,name)
end
end end
end end
end end