Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- All of this is from my admin mod
- -- RegisterPlugin
- -- Not really necessary, but helps to make it simpler to add shit
- function moderari.RegisterPlugin(name, tab)
- name=name or tab.Name or nil
- if !name then return end
- moderari.Plugins[name]=tab
- moderari.Plugins[name].ChatText=tab.ChatText or function() return nil end
- --moderari.Plugins[name].Command=string.lower(moderari.Plugins[name].Command)
- print("Plugin \""..name.."\" loaded!")
- end
- --Example plugin
- local PLUGIN={}
- PLUGIN.Name="Ban"
- PLUGIN.Command="ban"
- PLUGIN.CallableOnPlayers=true
- PLUGIN.Immunity=40
- PLUGIN.Category="Administration"
- PLUGIN.OverrideMenuSelect=function(ply, target)
- --function here
- end
- PLUGIN.OnCall=function(ply, players, args)
- --function
- end
- moderari.RegisterPlugin("Ban", PLUGIN)
- -- Loading files from a folder
- function moderari.LoadPlugins()
- moderari.Plugins={}
- for f, v in pairs(file.FindInLua("mr_plugins/*.lua")) do
- if string.Left(v, 2)=="sh" or string.Left(v, 2)=="cl" then
- if !moderari.InitPluginsLoaded then
- AddCSLuaFile("mr_plugins/"..v)
- print("mr_plugins/"..v.." loaded clientside.")
- moderari.InitPluginsLoaded=true
- else
- SendLuaToClient("mr_plugins/"..v)
- print("mr_plugins/"..v.." loaded clientside.")
- end
- end
- if SERVER then
- if string.Left(v, 2)!="cl" then
- include("mr_plugins/"..v)
- end
- else
- include("mr_plugins/"..v)
- end
- end
- end
- hook.Add("Initialize", "loadModerariPlugins", function()
- MsgN("======================")
- moderari.LoadPlugins()
- MsgN("======================")
- moderari.InitPluginsLoaded=true
- end)
Advertisement
Add Comment
Please, Sign In to add comment