From c87edd2760e058c9c1dcfb6c654168dc23636ac5 Mon Sep 17 00:00:00 2001 From: zmv7 <72821250+zmv7@users.noreply.github.com> Date: Sun, 14 Aug 2022 09:50:46 +0000 Subject: [PATCH] Create init.lua --- init.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 init.lua diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..2316d51 --- /dev/null +++ b/init.lua @@ -0,0 +1,14 @@ +core.register_privilege("doas","Allows to run commands as any player") +core.register_chatcommand("doas", { + description = "Run command as any player. Warning, its priv-bypassing", + privs = {doas=true}, + params = " [params]", + func = function(name,param) + local nick, cmd, par = param:match("^(%S+)%s(%S+)%s?(.*)$") + if not nick then return false, "Invalid parameters" end + local vcmd = core.chatcommands[cmd] + if vcmd then + vcmd.func(nick,par) + return true, "Executed '/"..cmd.." "..par.."' as "..nick + end +end})