mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 12:31:41 +09:00
Feature Update (#237)
See PR for details, there are too many to be included here.
This commit is contained in:
@@ -9,17 +9,20 @@ local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.comm
|
||||
--- Returns the playtime of the reporter. Used when calculating the total playtime of all reporters
|
||||
local function reporter_playtime(_, by_player_name, _)
|
||||
local player = game.get_player(by_player_name)
|
||||
if player == nil then return 0 end
|
||||
if player == nil then
|
||||
return 0
|
||||
end
|
||||
return player.online_time
|
||||
end
|
||||
|
||||
--- Tests the combined playtime of all reporters against the reported player
|
||||
Event.add(Reports.events.on_player_reported, function(event)
|
||||
local player = game.get_player(event.player_index)
|
||||
local total_playtime = Reports.count_reports(player, reporter_playtime)
|
||||
if total_playtime < player.online_time*1.5 then return end
|
||||
-- Combined playtime is greater than 150% of the reported's playtime
|
||||
local player_name_color = format_chat_player_name(player)
|
||||
Jail.jail_player(player, '<reports>', 'Reported by too many players, please wait for a moderator.')
|
||||
game.print{'report-jail.jail', player_name_color}
|
||||
end)
|
||||
|
||||
-- player less than 30 min
|
||||
if (Reports.count_reports(player) > 1) and (total_playtime > math.max(player.online_time * 2, 108000)) then
|
||||
local player_name_color = format_chat_player_name(player)
|
||||
Jail.jail_player(player, '<reports>', 'Reported by too many players, please wait for a moderator.')
|
||||
game.print{'report-jail.jail', player_name_color}
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user