Raised This Month: $51 Target: $400
 12% 

Post hook engine::GetClientConVar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mysterious
Junior Member
Join Date: Apr 2009
Old 07-04-2009 , 16:28   Post hook engine::GetClientConVar
Reply With Quote #1

I want to post hook the engine::GetClientConVar function but I don't know how to do it. Actually I don't really know what post hooking does... Will it receive the return value of the GetClientConVar function as a parameter or will it receive the standard params of the hooked function? I would like to change the return value if it's not like that/what it's meant to be. (I wonder if this sentence makes any sense ^^) Thanks in Advance Mysterious
Mysterious is offline
BAILOPAN
Join Date: Jan 2004
Old 07-05-2009 , 04:11   Re: Post hook engine::GetClientConVar
Reply With Quote #2

Order of operations:
1. SourceHook invokes all pre hooks.
2. SourceHook invokes the original function.
3. SourceHook invokes all post hooks.

You receive the parameters of the hooked function, always (in fact the signature must be identical). In a post hook you can access the original return value with the META_RESULT_ORIG_RET() macro, and you can override the return value as normal. (Note: playing nicely with other plugins is slightly more complicated - you should really check the return status with META_RESULT_STATUS to see if the return value has been overridden, and if so, call META_RESULT_OVERRIDE_RET instead of the other macro).

Anyway, if you meant IVEngineServer::GetClientConVarValue, just be forewarned that the engine itself probably won't call this virtually. The game might though.
__________________
egg
BAILOPAN is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 07-05-2009 , 09:56   Re: Post hook engine::GetClientConVar
Reply With Quote #3

Hmm, that might explain why I was getting random values from META_RESULT_ORIG_RET() in a pre-hook, thanks BAIL
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
Mysterious
Junior Member
Join Date: Apr 2009
Old 07-05-2009 , 17:41   Re: Post hook engine::GetClientConVar
Reply With Quote #4

Thank you very much. That's exactly what I wanted With best wishes Mysterious
Mysterious is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 07-14-2009 , 22:37   Re: Post hook engine::GetClientConVar
Reply With Quote #5

Quote:
Originally Posted by DJ Tsunami View Post
Hmm, that might explain why I was getting random values from META_RESULT_ORIG_RET() in a pre-hook, thanks BAIL
Silly Tsunami. You can't get a result before the function calculates a result to return. arrrrrrgh!
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 07-15-2009 , 06:30   Re: Post hook engine::GetClientConVar
Reply With Quote #6

__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
Reply



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 11:13.


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