From bbb257de5afb56d5ab3e84e9f3304df2c9ba8502 Mon Sep 17 00:00:00 2001 From: Yiu Man Ho Date: Sat, 12 Sep 2020 15:46:28 +0800 Subject: [PATCH] Publish --- init.lua | 18 ++++++++++++++++++ mod.conf | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 init.lua create mode 100644 mod.conf diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..a4cbbf2 --- /dev/null +++ b/init.lua @@ -0,0 +1,18 @@ +minetest.register_chatcommand("user_info",{ + param = "", + description = "Get your client's info", -- Full description + func = function(name, param) + if not(param == "") then + local havepriv, m = minetest.check_player_privs(name, {server=true}) + if not(havepriv) then + return false, "No privs to do this!" + end + name = param + end + local info = minetest.get_player_information(name) + if not info then return false, "player not found!" end + minetest.chat_send_player(name, "Info of "..name..":") + minetest.chat_send_player(name, "IP: "..info.address.." (IPv"..tostring(info.ip_version)..")") + minetest.chat_send_player(name, "Uptime: "..tostring(info.connection_uptime).."sec") + end, +}) diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..1c7bd5f --- /dev/null +++ b/mod.conf @@ -0,0 +1,2 @@ +name = my_info +description = Get Player's info