hook = {} hook.Hooks = {} hook.Count = 0 hook.ALL = 1 hook.MSG = 2 hook.PM = 3 hook.JOIN = 4 function hook.Call(typ, ...) for k,v in hook.Hooks do if v.type == typ or v.type == hook.ALL then v.func(unpack(arg)) end end end function hook.Add(func, typ, name) typ = typ or hook.ALL name = name or "hook"..hook.Count if not table.haskey(hook.Hooks, name) hook.Count = hook.Count + 1 end hook.Hooks[name] = {func = func, type = typ} end function hook.Remove(name) table.remove(hook.Hooks, name) end