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

DHooks (Dynamic Hooks - Dev Preview)


Post New Thread Reply   
 
Thread Tools Display Modes
Blunderstab
Junior Member
Join Date: Nov 2015
Old 10-27-2017 , 14:20   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #571

Hello again! I'm trying to bend the new Flamethrower mechanics to my will and there's something I'm trying to figure out. "CTFFlameManager::InitializePoint(tf_point_t* , int)" Both Flame Manager and tf_point_t are brand new to this update.

I'm trying to work out how to get that tf_point_t*. I've been trying all sorts of ideas from other code in this thread and elsewhere but I can't seem to get any results. I'm more than willing to do the tedious work, but I want to make sure I'm headed in the right direction first.

"DHookAddParam(Handle, HookParamType_Object)" always causes a crash, but if I set the size to "32" it crashes differently. The server doesn't immediately give me a windows "not responding" box, it actually just hangs indefinitely until I close it myself. Any other number causes the same problem as not having a number at all. Is that a clue? Is HookParamType_Object the wrong thing entirely? I just want to get the AddParam correct so I can work out getting the data inside.

Thanks in advance!
Blunderstab is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 10-27-2017 , 15:00   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #572

Quote:
Originally Posted by Blunderstab View Post
Hello again! I'm trying to bend the new Flamethrower mechanics to my will and there's something I'm trying to figure out. "CTFFlameManager::InitializePoint(tf_point_t* , int)" Both Flame Manager and tf_point_t are brand new to this update.

I'm trying to work out how to get that tf_point_t*. I've been trying all sorts of ideas from other code in this thread and elsewhere but I can't seem to get any results. I'm more than willing to do the tedious work, but I want to make sure I'm headed in the right direction first.

"DHookAddParam(Handle, HookParamType_Object)" always causes a crash, but if I set the size to "32" it crashes differently. The server doesn't immediately give me a windows "not responding" box, it actually just hangs indefinitely until I close it myself. Any other number causes the same problem as not having a number at all. Is that a clue? Is HookParamType_Object the wrong thing entirely? I just want to get the AddParam correct so I can work out getting the data inside.

Thanks in advance!
HookParamType_ObjectPtr
__________________

Last edited by Pelipoika; 10-27-2017 at 15:00.
Pelipoika is offline
Blunderstab
Junior Member
Join Date: Nov 2015
Old 10-27-2017 , 15:26   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #573

I tried that as well and it seemed to only have data at 0. It seemed to just be a giant int. Wouldn't it be strange for the object to only contain one value? 4 and higher had nothing at all. Maybe that's just the way it is though. Any thoughts?
Blunderstab is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 10-27-2017 , 15:52   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #574

Quote:
Originally Posted by Blunderstab View Post
I tried that as well and it seemed to only have data at 0. It seemed to just be a giant int. Wouldn't it be strange for the object to only contain one value? 4 and higher had nothing at all. Maybe that's just the way it is though. Any thoughts?
What size did you use? try -1

Also make sure you're hooking tf_flame_manager (duh)
__________________

Last edited by Pelipoika; 10-27-2017 at 15:54.
Pelipoika is offline
Blunderstab
Junior Member
Join Date: Nov 2015
Old 10-27-2017 , 16:00   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #575

Absolutely hooking flame manager. The int it returns is "2009493684". Not using a size or using -1 has the same result. This also goes for every flame manager when you have multiples.

Edit: IntPtr returns "2005468208"

Last edited by Blunderstab; 10-27-2017 at 16:03.
Blunderstab is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 10-27-2017 , 16:05   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #576

Quote:
Originally Posted by Blunderstab View Post
Absolutely hooking flame manager. The int it returns is "2009493684". Not using a size or using -1 has the same result. This also goes for every flame manager when you have multiples.

Edit: IntPtr returns "2005468208"
Well it is an object so that return is propably the address. You have to use DHookGetParamObjectPtrVar to access the values inside the object
__________________
Pelipoika is offline
Blunderstab
Junior Member
Join Date: Nov 2015
Old 10-27-2017 , 16:05   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #577

DHookGetParamObjectPtrVar(hParams, 1, 0, ObjectValueType_Int) is what I'm using.
Blunderstab is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 10-27-2017 , 16:18   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #578

PHP Code:
#pragma semicolon 1

#include <dhooks>

Handle g_hInitializePoint;

public 
void OnPluginStart()
{
    
/*
    CTFFlameManager::InitializePoint
    */
    
g_hInitializePoint DHookCreate(192HookType_EntityReturnType_VoidThisPointer_CBaseEntityCTFFlameManager_InitializePoint);
    
DHookAddParam(g_hInitializePointHookParamType_ObjectPtr, -1);
    
DHookAddParam(g_hInitializePointHookParamType_Int);
}

public 
void OnEntityCreated(int entity, const char[] classname)
{
    if(
StrEqual(classname"tf_flame_manager"))
    {
        
DHookEntity(g_hInitializePointtrueentity);
        
        
PrintToServer("Hooked CTFFlameManager::InitializePoint on tf_flame_manager %i"entity);
    }
}

public 
MRESReturn CTFFlameManager_InitializePoint(int pThisHandle hParams)
{
    
/*
    CTFFlameManager::InitializePoint @ (40.296852 -150.358459 -132.557815) vel (1379.987182 -1798.679809 -396.164093) seed 0 lifetime 0.517885 gametime 891.989990
    CTFFlameManager::InitializePoint @ (40.296852 -150.358459 -132.557815) vel (1404.413330 -1778.986694 -397.125122) seed 1 lifetime 0.687542 gametime 892.019958
    CTFFlameManager::InitializePoint @ (40.296852 -150.358459 -132.557815) vel (1383.478637 -1812.721557 -305.252166) seed 2 lifetime 0.699721 gametime 892.049987
    CTFFlameManager::InitializePoint @ (40.296852 -150.358459 -132.557815) vel (1443.273925 -1772.890258 -262.350708) seed 3 lifetime 0.512817 gametime 892.079956
    CTFFlameManager::InitializePoint @ (40.296852 -150.358459 -132.557815) vel (1466.293212 -1740.187744 -339.652008) seed 4 lifetime 0.541388 gametime 892.109985
    CTFFlameManager::InitializePoint @ (40.296852 -150.358459 -132.557815) vel (1458.359497 -1738.543212 -382.771759) seed 5 lifetime 0.523758 gametime 892.139953
    CTFFlameManager::InitializePoint @ (40.296852 -150.358459 -132.557815) vel (1369.047729 -1817.329589 -342.638122) seed 6 lifetime 0.697839 gametime 892.169982
    */

    //CTFPointManager::GetInitialPosition()
    
float x DHookGetParamObjectPtrVar(hParams14ObjectValueType_Float);
    
float y DHookGetParamObjectPtrVar(hParams18ObjectValueType_Float);
    
float z DHookGetParamObjectPtrVar(hParams112ObjectValueType_Float);
    
    
//CTFPointManager::GetInitialVelocity()
    
float velX DHookGetParamObjectPtrVar(hParams116ObjectValueType_Float);
    
float velY DHookGetParamObjectPtrVar(hParams120ObjectValueType_Float);
    
float velZ DHookGetParamObjectPtrVar(hParams124ObjectValueType_Float);
    
    
//GetGameTime()
    
float gameTime DHookGetParamObjectPtrVar(hParams128ObjectValueType_Float);
    
    
//CTFPointManager::GetLifeTime()
    
float flLifeTime DHookGetParamObjectPtrVar(hParams132ObjectValueType_Float);
    
    
//seed
    
int seed DHookGetParamObjectPtrVar(hParams136ObjectValueType_Int);
    
    
PrintToServer("CTFFlameManager::InitializePoint @ (%f %f %f) vel (%f %f %f) seed %i lifetime %f gametime %f"xyzvelXvelYvelZseedflLifeTimegameTime);

    return 
MRES_Ignored;

__________________

Last edited by Pelipoika; 10-27-2017 at 16:46. Reason: All secrets revealed
Pelipoika is offline
Blunderstab
Junior Member
Join Date: Nov 2015
Old 10-27-2017 , 16:21   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #579

Oooh, I bet it's because I used false for post... I'll give this a try. Thanks!

Edit: This was 100% my problem.

Last edited by Blunderstab; 10-27-2017 at 16:23.
Blunderstab is offline
Agent Wesker
Senior Member
Join Date: Apr 2012
Old 11-20-2017 , 13:14   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #580

Hello

A user reports my plugin does not work properly on his Linux server...

The problem seems to be the value is not received from this:
Code:
DHookGetParamObjectPtrString(hParams, 4, 0, ObjectValueType_String, eParam, sizeof(eParam));
(Line 234) https://github.com/AgentWesker/StopM...music_dhook.sp

It should be set to the (string) parameter of an entity input, but comes back null / blank.

I've tested on two Windows servers and it works fine, any suggestions?

Last edited by Agent Wesker; 11-20-2017 at 13:18.
Agent Wesker is offline
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 20:43.


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