TF2 run_command hook

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
L'In20Cible
Project Leader
Posts: 1536
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: TF2 run_command hook

Postby L'In20Cible » Thu Jul 14, 2016 3:43 pm

Yes, sorry. :smile:
User avatar
satoon101
Project Leader
Posts: 2725
Joined: Sat Jul 07, 2012 1:59 am

Re: TF2 run_command hook

Postby satoon101 » Thu Jul 14, 2016 3:44 pm

Yes, players.bots is correct.

You will also need to change is_bot to is_fake_client in that script.
Image
User avatar
quartata
Member
Posts: 77
Joined: Wed Jun 22, 2016 11:49 pm

Re: TF2 run_command hook

Postby quartata » Thu Jul 14, 2016 3:46 pm

OK, just tried it and it still segfaults. Weird. I added a print statement just to make sure that is_fake_client() was working (it is, returned true). So the pointer isn't pointing to an instance of BotCmd either
User avatar
L'In20Cible
Project Leader
Posts: 1536
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: TF2 run_command hook

Postby L'In20Cible » Thu Jul 14, 2016 3:51 pm

satoon101 wrote:You will also need to change is_bot to is_fake_client in that script.
Nice catch! Too many methods exposed, getting confusing without looking twice. :tongue:

quartata wrote:OK, just tried it and it still segfaults. Weird. I added a print statement just to make sure that is_fake_client() was working (it is, returned true). So the pointer isn't pointing to an instance of BotCmd either
Maybe it is simply called with a NULL pointer... what does print(stack[1].address) prints to the console?
User avatar
quartata
Member
Posts: 77
Joined: Wed Jun 22, 2016 11:49 pm

Re: TF2 run_command hook

Postby quartata » Thu Jul 14, 2016 3:54 pm

It's not 0.
User avatar
quartata
Member
Posts: 77
Joined: Wed Jun 22, 2016 11:49 pm

Re: TF2 run_command hook

Postby quartata » Thu Jul 14, 2016 3:57 pm

Off topic (although it was related to what I was planning to use the hook for), but is there any way to set a listener for when a certain client convar changes? I was going to use a tick listener and engine_server.get_client_convar_value but that feels a little inelegant.
User avatar
L'In20Cible
Project Leader
Posts: 1536
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: TF2 run_command hook

Postby L'In20Cible » Thu Jul 14, 2016 4:04 pm

quartata wrote:Off topic (although it was related to what I was planning to use the hook for), but is there any way to set a listener for when a certain client convar changes? I was going to use a tick listener and engine_server.get_client_convar_value but that feels a little inelegant.

search.php?keywords=OnConVarChanged

Please, create a new topic next time!
User avatar
L'In20Cible
Project Leader
Posts: 1536
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: TF2 run_command hook

Postby L'In20Cible » Thu Jul 14, 2016 4:14 pm

As for the main issue of this topic, for now, you could simply filter bots and exit the callback. I will see if I can find the exact cause once my virtual is updated.

And please, could you create an issue on GitHub (be sure to link that thread) so we can keep track there? Thank you!
User avatar
quartata
Member
Posts: 77
Joined: Wed Jun 22, 2016 11:49 pm

Re: TF2 run_command hook

Postby quartata » Thu Jul 14, 2016 4:15 pm

L'In20Cible wrote:As for the main issue of this topic, for now, you could simply filter bots and exit the callback. I will see if I can find the exact cause once my virtual is updated.


Yeah, that's what I plan to do. It's really not a big deal since I would only being adding puppet bots for testing and it seems to work for "real" bots (NextBots).
User avatar
quartata
Member
Posts: 77
Joined: Wed Jun 22, 2016 11:49 pm

Re: TF2 run_command hook

Postby quartata » Thu Jul 14, 2016 4:29 pm

Issue added.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 47 guests