mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 19:45:22 +09:00
Fixed double report message to admins
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user