From f24214cd46b23ac8f27805080c76baf4a5104bf7 Mon Sep 17 00:00:00 2001 From: s20 <129506166+src4026@users.noreply.github.com> Date: Thu, 26 Oct 2023 23:10:57 +0530 Subject: [PATCH] Add time left to text shown when timer is not over --- mods/ctf/ctf_modebase/ranking_commands.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mods/ctf/ctf_modebase/ranking_commands.lua b/mods/ctf/ctf_modebase/ranking_commands.lua index 8b95849d89..be7dfeefb5 100644 --- a/mods/ctf/ctf_modebase/ranking_commands.lua +++ b/mods/ctf/ctf_modebase/ranking_commands.lua @@ -152,7 +152,12 @@ minetest.register_chatcommand("donate", { end if donate_timer[name] and donate_timer[name] + 300 > os.time() then - return false, "You can donate only once in 5 minutes!" + local time_diff = donate_timer[name] + 300 - os.time() + return false, string.format( + "You can donate only once in 5 minutes! You can donate again in %dm %ds.", + math.floor(time_diff / 60), + time_diff % 60, + ) end current_mode.recent_rankings.add(pname, {score=score}, true)