From 41650823544540eb80a7d6a86390924680024466 Mon Sep 17 00:00:00 2001 From: shamoanjac Date: Sun, 28 Aug 2016 12:19:58 +0200 Subject: [PATCH] Added /f seen --- chatcommands.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/chatcommands.lua b/chatcommands.lua index 0b10ad2..7c19bc9 100644 --- a/chatcommands.lua +++ b/chatcommands.lua @@ -673,6 +673,24 @@ factions.register_command("stats", { end }) +factions.register_command("seen", { + description = "Check the last time a faction had a member logged in", + infaction = false, + global_privileges = {"faction_admin"}, + format = {"faction"}, + on_success = function(player, faction, pos, parcelpos, args) + local lastseen = args.factions[1].last_logon + local now = os.time() + local time = now - lastseen + local minutes = math.floor(time / 60) + local hours = math.floor(minutes / 60) + local days = math.floor(hours / 24) + minetest.chat_send_player(player, "Last seen "..days.." day(s), ".. + hours % 24 .." hour(s), "..minutes % 60 .." minutes, "..time % 60 .." second(s) ago.") + return true + end +}) + ------------------------------------------------------------------------------- -- name: cmdhandler(playername,parameter) --