Add init.lua

This commit is contained in:
rubenwardy 2015-12-11 17:45:32 +00:00
parent ed6c66ac55
commit edc4d17df2
1 changed files with 28 additions and 0 deletions

28
init.lua Normal file
View File

@ -0,0 +1,28 @@
if not chatplus.send_mail then
error("You need to update chatplus!")
end
minetest.register_chatcommand("report", {
func = function(name, param)
-- Send to online moderators / admins
-- Get comma separated list of online moderators and admins
local mods = ""
for _, player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name()
if minetest.check_player_privs(name, {kick=true,ban=true}) then
if mods ~= "" then
mods = mods .. ", "
end
mods = mods .. name
minetest.chat_send_player(name, "-!- " .. name .. " reported: " .. param)
end
end
-- I hope that none of the moderators are called "none"!
if mods == "" then
mods = "none"
end
chatplus.send_mail(name, minetest.setting_get("name"),
"Report: " .. param .. " (mods online: " .. mods .. ")")
end
})