Hooking OnPlayerRunCmd

Please post any questions about developing your plugin here. Please use the search function before posting!
roflmuffin
Junior Member
Posts: 19
Joined: Fri Nov 06, 2015 11:49 pm

Hooking OnPlayerRunCmd

Postby roflmuffin » Thu Dec 24, 2015 10:09 am

Hi there,

I know you can use the OnTick listener and use playerinfo.get_last_user_command() to get the same sort of information as OnPlayerRunCmd, but these values are of course read only.

I think it may involve some signature scanning, but I am totally new to Source.Python's memory module and trying to implement a solution. Would anyone be able to guide me towards a possible solution for this?

Thanks,
Roflmuffin
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Thu Dec 24, 2015 11:03 am

We have PlayerRunCommand already included, so it's extremely easy to hook it.

Syntax: Select all

from entities.hooks import EntityPreHook
from entities.hooks import EntityCondition

@EntityPreHook(EntityCondition.is_player, 'run_command')
def on_pre_player_run_command(args):
print(args)
roflmuffin
Junior Member
Posts: 19
Joined: Fri Nov 06, 2015 11:49 pm

Postby roflmuffin » Thu Dec 24, 2015 11:17 am

Well don't I feel silly... Do you know when this was added? A quick glance at GitHub says August.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Thu Dec 24, 2015 2:50 pm

Looks like the offsets were originally added to our data on August 14:
https://github.com/Source-Python-Dev-Team/Source.Python/commit/77859ac6f696dce71e22f18157b0b5ac2ca88cc8
Image
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Thu Dec 24, 2015 6:21 pm

You could also try to get/set Player.buttons (points at m_nButtons) attribute.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 126 guests