Solved Writing own hooks

Discussion in 'Hurtworld Development' started by DJDiamonD, Mar 18, 2016.

  1. Please help guys. An example or tutorial please.
     
  2. Wulf

    Wulf Community Admin

    Are you wanting to add new hooks to the game, or just to your own plugin?
     
  3. Oh.. I need hook for a my few plugins. Not for one plugin. For example i need to write a hook for my CLAN plugins and Building Plugin.
     
  4. Wulf

    Wulf Community Admin

    There are a few threads on calling hooks in other plugins, and the Docs has some generic examples too: Rust.
     
  5. Okey, but i need to write OnPlayerTakeDamage hook. How can i do it? I heard that i will need Oxide Patcher. How can i use it? Where is located .opj file for Hurtworld?
     
  6. Wulf

    Wulf Community Admin

    That's a bit more complicated. The patcher is in our Snapsots repo, the .opj is in our Oxide repo. From there you'd have to find where that hook would need to be, then hook it with the correct index, arguments, and return behavior. If you don't know how to do that, I'd recommend waiting for the hook to be added officially.
     
  7. But i want to write them, i don't wait to stay and to wait, i want to learn(
     
  8. Wulf

    Wulf Community Admin

    Well, start with the steps I mentioned. ;)
     
  9. Okey, can you give me URL to opj Hurtworld file please? I want to see it in Oxide Patcher)
     
  10. Wulf

    Wulf Community Admin

  11. And why my messages are now moderating?
     
  12. Wulf

    Wulf Community Admin

    They aren't, it was just flagged by the link.
     
  13. Okey) And when are you planning to add OnPlayerDamage hook?
     
  14. Wulf

    Wulf Community Admin

    Hopefully soon, just been busy. :)
     
  15. Thanks) Guy help, how can i download file from github?
    [DOUBLEPOST=1458313687][/DOUBLEPOST]
    And help please. What it want from me? http://i.imgur.com/hNAmr3r.png
     
  16. Wulf

    Wulf Community Admin

    You'd need to change the path to your server install in the .opj file.
     
  17. "TargetDirectory": "C:\\Users\thematkon\Desktop\hurtworld\server\Hurtworld_Data\Managed",
    And? It does not work
    [DOUBLEPOST=1458314833][/DOUBLEPOST]Solved, thanks.
     
  18. Wulf

    Wulf Community Admin

    Double-slash \\ ;)
     
  19. Are you guys using a special tool to generate the .opj file and find out the hook or is it a manual process? Data looks like JSON or XMLSerialize from .Net.

    I understand all the fields besides MSILHash and know how to obtain them using ReflexIL Instructions/various panels.
    How do you obtain MSILHash??

    I'm evaluating how hard it is to make hooks from scratch for a game that has no Oxide support at all at the moment (Car Mechanic Simulator 2015) and which is client-only (so no server).

    EDIT: Nevermind, just start from an existing .opj, change the "TargetDirectory" and you'll be able to use OxidePatcher to add hooks.
     
    Last edited by a moderator: Jan 16, 2017