1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-18 00:08:25 +01:00

Added itemdb command into _miscs

- Added itemdb command to get an item's itemstring
This commit is contained in:
LeMagnesium 2015-04-09 14:39:11 +02:00
parent 66cad396f2
commit 89893df9ba

View File

@ -20,6 +20,7 @@
-- /rollback_check -- /rollback_check
-- /rollback -- /rollback
-- /status -- /status
-- /itemdb
minetest.register_chatcommand("time", { minetest.register_chatcommand("time", {
params = "<0...24000>", params = "<0...24000>",
@ -69,6 +70,30 @@ minetest.register_chatcommand("ban", {
end, end,
}) })
minetest.register_chatcommand("itemdb", {
params = "",
description = "Give itemstring of wielded item",
privs = {},
func = function(name)
local player = minetest.get_player_by_name(name)
if not player then return false end
local item = player:get_wielded_item()
if item:get_name() == "" then
minetest.chat_send_player(name,"You're handling nothing.")
return true
else
if not minetest.registered_items[item:get_name()] then
minetest.chat_send_player(name,"You are handling an unknown item (known before as " .. item:get_name() ..").")
return true
else
minetest.chat_send_player(name,"You are handling a " .. minetest.registered_items[item:get_name()].description .. " also known as " .. item:get_name() .. ".")
return true
end
end
end
})
-- /unban -- /unban
-- /kick -- /kick
-- /clearobjects -- /clearobjects