Create init.lua

master
zmv7 2022-08-14 09:50:46 +00:00 committed by GitHub
parent b898d4a92c
commit c87edd2760
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

14
init.lua Normal file
View File

@ -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 = "<playername> <command> [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})