Page 1 of 1

hooking "prethink" only runs when ducking [TF2]

Posted: Fri Aug 03, 2018 1:47 am
by nergal
having a weird issue on TF2 build.
hooking to Prethink only prints when a player is ducking...
here's code

Syntax: Select all

@EntityPostHook(EntityCondition.is_player, 'pre_think')
def _pre_think(stack_data:'memory.StackData as list/tuple of pointers.', ret:object) -> None:
player = memory.make_object(Player, stack_data[0]);
print('player "' + player.name + '" is postprethinking!');


excuse my excessive semicolons (I primarily code C) but shouldn't "pre_think" run and print almost every frame rather than everytime I press +DUCK?

Re: hooking "prethink" only runs when ducking [TF2]

Posted: Fri Aug 03, 2018 2:48 am
by L'In20Cible
The offsets are outdated it seems. Should be 337 and 336: https://github.com/Source-Python-Dev-Te ... ini#L9-L12

Feel free to use this tool to update them and submit a pull request if you feel like it. :smile:

Re: hooking "prethink" only runs when ducking [TF2]

Posted: Fri Aug 03, 2018 3:57 pm
by VinciT
I went ahead and updated all of the TF offsets.

Re: hooking "prethink" only runs when ducking [TF2]

Posted: Fri Aug 03, 2018 4:22 pm
by nergal
L'In20Cible wrote:The offsets are outdated it seems. Should be 337 and 336: https://github.com/Source-Python-Dev-Te ... ini#L9-L12

Feel free to use this tool to update them and submit a pull request if you feel like it. :smile:


oof, thanks L'In20.

edit: I updated the data info but it's still only firing the code when I duck :/

Re: hooking "prethink" only runs when ducking [TF2]

Posted: Fri Aug 03, 2018 4:39 pm
by nergal
VinciT wrote:I went ahead and updated all of the TF offsets.


ayyy now it works! thx Vinc. Source.python doesn't auto update the offsets?

Re: hooking "prethink" only runs when ducking [TF2]

Posted: Fri Aug 03, 2018 5:58 pm
by VinciT
From what I've seen, no. Someone has to manually update the offsets.
Once the changes made on github make it into the latest build, you can run the sp update command on your server to get the latest version without changing the files yourself.

Re: hooking "prethink" only runs when ducking [TF2]

Posted: Sun Aug 05, 2018 4:45 am
by Ayuto
That's partially correct. If we update offsets on GitHub, you only need to restart your server to receive the latest offsets. There is a setting in the core settings to disable this behavior.
Then there is also the update command "sp update", which does a full update of your SP installation. So, not only offsets are getting updated, but also all other files.

Re: hooking "prethink" only runs when ducking [TF2]

Posted: Sun Aug 05, 2018 3:24 pm
by VinciT
Oh, I had no idea. That's awesome!