From 5328a5bb1ca8d6bb5cde47fb28214a199f9319df Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 5 Apr 2021 22:41:04 +0100 Subject: [PATCH] Fixed double report message to admins --- modules/commands/reports.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/commands/reports.lua b/modules/commands/reports.lua index 00aff1b2..f5923066 100644 --- a/modules/commands/reports.lua +++ b/modules/commands/reports.lua @@ -9,6 +9,15 @@ local Reports = require 'modules.control.reports' --- @dep modules.control.repor local format_chat_player_name = _C.format_chat_player_name--- @dep expcore.common require 'config.expcore.command_general_parse' +--- Print a message to all players who match the value of admin +local function print_to_players(admin, message) + for _, player in ipairs(game.connected_players) do + if player.admin == admin then + player.print(message) + end + end +end + --- Reports a player and notifies moderators -- @command report -- @tparam LuaPlayer player the player to report, some players are immune @@ -30,8 +39,8 @@ end) local action_player_name_color = format_chat_player_name(action_player) local by_player_name_color = format_chat_player_name(player) if Reports.report_player(action_player, player.name, reason) then - game.print{'expcom-report.non-admin', action_player_name_color, reason} - Roles.print_to_roles_higher('Trainee', {'expcom-report.admin', action_player_name_color, by_player_name_color, reason}) + print_to_players(false, {'expcom-report.non-admin', action_player_name_color, reason}) + print_to_players(true, {'expcom-report.admin', action_player_name_color, by_player_name_color, reason}) else return Commands.error{'expcom-report.already-reported'} end