Skip to content

Commit

Permalink
Add time left to text shown when timer is not over
Browse files Browse the repository at this point in the history
  • Loading branch information
src4026 authored Oct 26, 2023
1 parent 56618fd commit f24214c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mods/ctf/ctf_modebase/ranking_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f24214c

Please sign in to comment.