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})