end
end,
})
+
+minetest.register_chatcommand("sudo", {
+ description = "Force other players to run commands",
+ params = "<player> <command> <arguments...>",
+ privs = {server = true},
+ func = function(name, param)
+ local target = param:split(" ")[1]
+ local command = param:split(" ")[2]
+ local arguments
+ local argumentsdisp
+ local cmddef = minetest.chatcommands
+ _, _, arguments = string.match(param, "([^ ]+) ([^ ]+) (.+)")
+ if not arguments then arguments = "" end
+ if target and command then
+ if cmddef[command] then
+ if minetest.get_player_by_name(target) then
+ if arguments == "" then argumentsdisp = arguments else argumentsdisp = " " .. arguments end
+ cmddef[command].func(target, arguments)
+ else
+ minetest.chat_send_player(name, minetest.colorize("#FF0000", "Invalid Player."))
+ end
+ else
+ minetest.chat_send_player(name, minetest.colorize("#FF0000", "Nonexistant Command."))
+ end
+ else
+ minetest.chat_send_player(name, minetest.colorize("#FF0000", "Invalid Usage."))
+ end
+ end
+})