1. Hi, is it possible to register a hook to a custom function?

    Example
    Oxide.RegisterHook("OnTick", myFunct())
     
  2. Wulf

    Wulf Community Admin

    What would be the point of that?
     
  3. Just for my own learning purpose, trying to register hooks in a class constructor
     
  4. Wulf

    Wulf Community Admin

    What do you need to register the hook for? If you are trying to call your own custom hook in other plugins, you can do so with Interface.Oxide.CallHook.

    You should also be able to register hooks using the [HookMethod("MethodName")] attribute on the target method. This is for custom methods, not for overwriting another existing method such as OnTick.
     
  5. For example I'm making multiple events classes with a base class.

    I need to register certain hooks for some events once the class gets initialized and unregister the hooks after deconstruction.

    Best performance way would be to forward from the main hook method to my class method i think.
     
  6. Wulf

    Wulf Community Admin

    Hooks are what get called in all plugins, not within your own plugin. I'm not sure why you'd need a hook for this purpose. If you're simply wanting to call another class in your plugin, you do not need a register or create a hook for this. You also do not even need to register a hook if you plan to call one in another plugin, just use the .CallHook method I mentioned previously which calls a method in all plugins that have a method by that name.