Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated playtime mod #63

Merged
merged 4 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions playtime/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,19 @@ local function format_duration(seconds)
end

minetest.register_chatcommand("playtime", {
params = "",
params = "[playername]",
description = S("See your total playtime on this server"),
func = function(name)
if minetest.get_player_by_name(name) then
func = function(name, player_name)
if player_name == "" then
player_name = name
end

if minetest.get_player_by_name(player_name) then
return true,
C("#63d437", "Total: ")..C("#ffea00", format_duration(playtime.get_total_playtime(name))).."\n"..
C("#63d437", "Current: ")..C("#ffea00", format_duration(playtime.get_session_playtime(name)))
C("#63d437", "Total: ")..C("#ffea00", format_duration(playtime.get_total_playtime(player_name))).."\n"..
C("#63d437", "Current: ")..C("#ffea00", format_duration(playtime.get_session_playtime(player_name)))
else
return false, S("You must be connected to run this command!")
return false, S("Player must be online to run this command!")
end
end,
})
5 changes: 3 additions & 2 deletions playtime/locale/playtime.fr.tr
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# textdomain: playtime

You must enter a existing player name!=Vous devez entrer un nom de joueur existant !
You must be connected to run this command!=Vous devez être connecté pour utiliser cette commande !
See your total playtime on this server=Voir votre temps de jeu total sur ce serveur
See your total playtime on this server=Voir votre temps de jeu total sur ce serveur
Player must be online to run this command!=Le joueur doit être en ligne pour exécuter cette commande !
Loading