traum 0 Posted May 20 Good day, I am trying to hook a Python function (Vehicle.onHealthChanged) with Python C Api. I create my hOnHealthChanged function like in the first codeblock. the problem is, I am hooking the onHealthChanged class function and I can‘t seem to get the vehicle instance when my hook gets called. Because I create the function with nullptr as the second parameter, „self“ will always be zero when called. When the original function gets called, the game has pass the vehicle instance as the first argument, to my understanding, but I can‘t get it. The first argument in args is newHealth. Do I have to hook every instance when it gets created or is there a way to dynamically get the needed vehicle instance? I am trying to make a simple hitmarker mod in C++ PyMethodDef hookedPlayerDef = { "onHealthChanged", hOnHealthChanged, 1, "hooked onHealthChanged"}; PyObject* hookedFunc = PyCFunction_New(&hookedPlayerDef, nullptr); hOnHealthChanged gets correctly called when a vehicle ingame receives damage, but it fails to execute the original method, because „self“ argument is zero and it needs the vehicle instance. 4 other arguments are correct. HMU if you got any idea Quote Share this post Link to post Short link Share on other sites