This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

DHooks (Dynamic Hooks - Dev Preview)


Post New Thread Reply   
 
Thread Tools Display Modes
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-08-2015 , 09:16   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #321

Quote:
Originally Posted by Dr!fter View Post
The hook wont refire after you change the params if thats what you mean. The hook fires pre the params are changed the function is then called (but doesnt fire the hook) then the value is returned. Ill give it more testing soon.
Yea, I am getting that side of things. It just doesn't seem to call the function when MRES_ChangedHandled is returned.

I just verified MRES_Handled is the same. It doesn't call the function or fire the posthook.

While a return of MRES_Override or MRES_ChangedOverride does call the function and gives this output:

Quote:
==============-----------------> OnGiveNamedItemResetTo(classname=weapon_knife _butterfly)
===============---------------------> OnGiveNamedItemPost(classname=weapon_knife, entity=524)
==============-----------------> OnGiveNamedItem(classname=weapon_hkp2000)
===============---------------------> OnGiveNamedItemPost(classname=weapon_hkp2000, entity=527)
I'll fix my example of my expected output as per my understanding from your last comment.

Quote:
==============-----------------> OnGiveNamedItemResetTo(classname=weapon_knife _butterfly)
===============---------------------> OnGiveNamedItemPost(classname=weapon_knife_butterfly, entity=524)
==============-----------------> OnGiveNamedItem(classname=weapon_hkp2000)
===============---------------------> OnGiveNamedItemPost(classname=weapon_hkp2000, entity=527)
__________________

Last edited by Neuro Toxin; 06-08-2015 at 09:17.
Neuro Toxin is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-08-2015 , 12:14   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #322

Fun fact: In TF2, if you attempt to change the classname of a weapon in GiveNamedItem (like TF2Items does), the game will reject that change and give the user nothing instead.

Chances are it has to do with some sort of validation going on with the classname and the CEconItemView's properties.

...which may be what's happening in CS:GO.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 06-08-2015 at 12:25.
Powerlord is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-08-2015 , 19:23   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #323

Ok. I'll find another offset to hook and replace a char[] param on to verify.
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-09-2015 , 02:27   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #324

Ok,

I just tried CBasePlayer::SetModel(char const*)

Spoiler


Which gives me this. http://prntscr.com/7eu8a3

Looks like the string is corrupting on it's way to call the real function.
__________________
Neuro Toxin is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 06-09-2015 , 08:36   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #325

Quote:
Originally Posted by Neuro Toxin View Post
Ok,

I just tried CBasePlayer::SetModel(char const*)

Spoiler


Which gives me this. http://prntscr.com/7eu8a3

Looks like the string is corrupting on it's way to call the real function.
This hook is in the test plugin so I know it works, however when i tested in csgo it worked but crashed after a few seconds, but it didnt appear dhooks related, it couldnt find the sequence for animations. Here was my output

output


What I then did (Cause i saw you did this again ) is removed the ByRef. The pointer isnt byref its byval, my byref code could be broken, but im not sure. After removing the ByRef the output was the same but i no longer got the crash from GetSequence after a while and no GetSequence spam in the server console.

Here is my code that run with no issues.

code


Edit:

I also tested the GiveNamedItem one now (a simplified version)

output


Note, I wasnt able to pick up the knife, but I know that CanUse returns false for this. So hooking CanUse on post and returing true if its your knife should do the trick. I think its canUse I tested this a long time ago.

Anyway My code
code


Besides simplifying the code a little in the prehook I simply removed the ByRef (again ) and changed the param to Unknown instead of int.

Last edited by Dr!fter; 06-09-2015 at 08:59.
Dr!fter is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-09-2015 , 08:58   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #326

<3

I'm going back to test my problem #1 example now
__________________
Neuro Toxin is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 06-09-2015 , 09:02   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #327

Quote:
Originally Posted by Neuro Toxin View Post
<3

I'm going back to test my problem #1 example now
I edited my post (while you were posting probably) Im also still looking at setting params as null just need to come up with a nice way to do it.
Dr!fter is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-09-2015 , 09:03   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #328

Yay, my problem in problem one is now solved!

In no c guru.

I read * as byref which is actually a pointer?!?

*Tail is between legs awaiting beating*

Edit: Triple cross post interpolation madness
__________________

Last edited by Neuro Toxin; 06-09-2015 at 09:04.
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-09-2015 , 09:05   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #329

Quote:
Originally Posted by Dr!fter View Post
I edited my post (while you were posting probably) Im also still looking at setting params as null just need to come up with a nice way to do it.
It's not required anymore, however, GiveNamedItem is a good example of potentially needing return INVALID_ENT_INDEX.
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 06-09-2015 , 09:06   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #330

Ps. Much <3 and I feel stupid now lol... I'm throwing you another donation!
__________________
Neuro Toxin 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 23:43.


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