Raised This Month: $32 Target: $400
 8% 

Personal vphook for each entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 07-15-2016 , 13:01   Personal vphook for each entity
Reply With Quote #1

I need to hook vtable function PlayerRunCmd for each player to a different function. SDKHooks do it somehow, but when I use SH_ADD_MANUALVPHOOK, the hook fires for any instance, not only for the hooked one.

Last edited by kadet.89; 07-15-2016 at 13:01.
kadet.89 is offline
Send a message via Skype™ to kadet.89
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 07-15-2016 , 14:43   Re: Personal vphook for each entity
Reply With Quote #2

SH_ADD_MANUALHOOK

Stupid "anti-shouting" feature...
__________________

Last edited by asherkin; 07-15-2016 at 14:45.
asherkin is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 07-16-2016 , 03:25   Re: Personal vphook for each entity
Reply With Quote #3

asherkin, thanks, it works. I'v got another problem now.

I need to call the hooked function, but for another instance of a player, is it possible?
Something of that kind:
PHP Code:
int Flash::Hook_OnTakeDamage(CTakeDamageInfoHack &info)
{
    
CBaseEntity *pEntity META_IFACEPTR(CBaseEntity);
    
SH_CALL_MANUALHOOK(OnTakeDamageplayer2)(info); //retranslate it to another player
    
...


Last edited by kadet.89; 07-16-2016 at 03:25.
kadet.89 is offline
Send a message via Skype™ to kadet.89
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 07-16-2016 , 04:57   Re: Personal vphook for each entity
Reply With Quote #4

SH_MCALL

You really need to read the SourceHook documentation.
__________________
asherkin is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 07-16-2016 , 08:17   Re: Personal vphook for each entity
Reply With Quote #5

asherkin, Thanks, I read the doc, but didn't understand that this macro was what I needed.
kadet.89 is offline
Send a message via Skype™ to kadet.89
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode