hooking "prethink" only runs when ducking [TF2]

Please post any questions about developing your plugin here. Please use the search function before posting!
nergal
Member
Posts: 57
Joined: Sun Mar 15, 2015 2:58 pm

hooking "prethink" only runs when ducking [TF2]

Postby nergal » Fri Aug 03, 2018 1:47 am

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?
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

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

Postby L'In20Cible » Fri Aug 03, 2018 2:48 am

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:
User avatar
VinciT
Senior Member
Posts: 331
Joined: Thu Dec 18, 2014 2:41 am

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

Postby VinciT » Fri Aug 03, 2018 3:57 pm

I went ahead and updated all of the TF offsets.
nergal
Member
Posts: 57
Joined: Sun Mar 15, 2015 2:58 pm

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

Postby nergal » Fri Aug 03, 2018 4:22 pm

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 :/
nergal
Member
Posts: 57
Joined: Sun Mar 15, 2015 2:58 pm

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

Postby nergal » Fri Aug 03, 2018 4:39 pm

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?
User avatar
VinciT
Senior Member
Posts: 331
Joined: Thu Dec 18, 2014 2:41 am

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

Postby VinciT » Fri Aug 03, 2018 5:58 pm

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.
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

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

Postby Ayuto » Sun Aug 05, 2018 4:45 am

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.
User avatar
VinciT
Senior Member
Posts: 331
Joined: Thu Dec 18, 2014 2:41 am

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

Postby VinciT » Sun Aug 05, 2018 3:24 pm

Oh, I had no idea. That's awesome!

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 24 guests