Skip to content

Commit

Permalink
Add time left to text shown when donation timer is not over (#1240)
Browse files Browse the repository at this point in the history
* Add time left to text shown when timer is not over

* Update ranking_commands.lua
  • Loading branch information
src4026 authored Nov 3, 2023
1 parent 8112aff commit 5614e34
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 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,11 @@ 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 5614e34

Please sign in to comment.