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
Author Message
Destral Alphaowner
New Member
Join Date: Oct 2015
Old 10-20-2015 , 16:25   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #1

THIS SUCK I DONT KNOW HOW TO PUT THIS INTO MY SERVER and i cannot use dropknife without it (
Someone help plz?
Destral Alphaowner is offline
freakav
Senior Member
Join Date: Jul 2016
Old 10-20-2016 , 18:34   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #2

A .smx file download pls .. im bad in compile and scripting
freakav is offline
splewis
Veteran Member
Join Date: Feb 2014
Location: United States
Old 10-20-2016 , 20:46   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #3

Quote:
Originally Posted by freakav View Post
A .smx file download pls .. im bad in compile and scripting
This isn't a sourcemod plugin, there's no smx file to give you. The "builds" page linked on the first post has links to the compiled extension for all platforms, though.
__________________
splewis is offline
Blunderstab
Junior Member
Join Date: Nov 2015
Old 11-05-2016 , 15:02   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #4

I'm having a server crash with my feeble attempts to learn how to use DHooks. I'm trying to hook the act of hitting a building with a wrench in TF2. I found the following:
Code:
CBaseObject::OnWrenchHit(CTFPlayer*, CTFWrench*, Vector)
My gamedata looks like this:
Code:
"Games"
{
    "tf"
    {
        "Offsets"
        {
            "OnWrenchHit"
            {
                "windows"    "356"
                "linux"    "358"
                "mac"    "358"
            }
        }
    }
}
And my actual code looks like this:
Code:
public OnPluginStart()
{
    AddNormalSoundHook(Hook_EntitySound);
    
    new Handle:temp = LoadGameConfigFile("tf2.blunderatts");
    
    if(temp == INVALID_HANDLE)
    {
        SetFailState("Why you no has gamedata?");
    }
    
    new offset;
    
    offset = GameConfGetOffset(temp, "OnWrenchHit");
    hOnWrenchHit = DHookCreate(offset, HookType_Entity, ReturnType_Void, ThisPointer_CBaseEntity, OnWrenchHit);
    DHookAddParam(hOnWrenchHit, HookParamType_CBaseEntity);
    DHookAddParam(hOnWrenchHit, HookParamType_CBaseEntity);
    DHookAddParam(hOnWrenchHit, HookParamType_Int);
    
    CloseHandle(temp);
}

public OnEntityCreated(entity, const String:classname[])
{
    if (StrEqual(classname, "obj_dispenser")
        || StrEqual(classname, "obj_sentrygun")
        || StrEqual(classname, "obj_teleporter"))
    {
        SDKHook(entity, SDKHook_SpawnPost, OnSpawnPost);
    }
}

public void OnSpawnPost(entity)
{
    DHookEntity(hOnWrenchHit, false, entity);
}

public MRESReturn OnWrenchHit(pThis, Handle:hParams)
{
    PrintToChatAll("Hit with wrench.");
    //PrintToChatAll("DHooksHacks = Building %d, Player %d", pThis, DHookGetParam(hParams, 1));
}
The moment an active building is struck with a wrench, the server crashes without even reaching the PrintToChatAll. I tested removing Teleporters from the list, and then the server wouldn't crash when hitting a Teleporter, even when having another building active. I've tried a few different Return Types and have put in the Handle:hReturn when necessary, but no dice. Given the specificness of the crash, it sounds like I'm on the right track. But I'm completely new to DHooks, so I just need a shove in the right direction.

Thanks in advance!
Blunderstab is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 11-05-2016 , 16:01   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #5

Quote:
Originally Posted by Blunderstab View Post
I'm having a server crash with my feeble attempts to learn how to use DHooks. I'm trying to hook the act of hitting a building with a wrench in TF2. I found the following:
Code:
CBaseObject::OnWrenchHit(CTFPlayer*, CTFWrench*, Vector)
My gamedata looks like this:
Code:
"Games"
{
    "tf"
    {
        "Offsets"
        {
            "OnWrenchHit"
            {
                "windows"    "356"
                "linux"    "358"
                "mac"    "358"
            }
        }
    }
}
And my actual code looks like this:
Code:
public OnPluginStart()
{
    AddNormalSoundHook(Hook_EntitySound);
    
    new Handle:temp = LoadGameConfigFile("tf2.blunderatts");
    
    if(temp == INVALID_HANDLE)
    {
        SetFailState("Why you no has gamedata?");
    }
    
    new offset;
    
    offset = GameConfGetOffset(temp, "OnWrenchHit");
    hOnWrenchHit = DHookCreate(offset, HookType_Entity, ReturnType_Void, ThisPointer_CBaseEntity, OnWrenchHit);
    DHookAddParam(hOnWrenchHit, HookParamType_CBaseEntity);
    DHookAddParam(hOnWrenchHit, HookParamType_CBaseEntity);
    DHookAddParam(hOnWrenchHit, HookParamType_Int);
    
    CloseHandle(temp);
}

public OnEntityCreated(entity, const String:classname[])
{
    if (StrEqual(classname, "obj_dispenser")
        || StrEqual(classname, "obj_sentrygun")
        || StrEqual(classname, "obj_teleporter"))
    {
        SDKHook(entity, SDKHook_SpawnPost, OnSpawnPost);
    }
}

public void OnSpawnPost(entity)
{
    DHookEntity(hOnWrenchHit, false, entity);
}

public MRESReturn OnWrenchHit(pThis, Handle:hParams)
{
    PrintToChatAll("Hit with wrench.");
    //PrintToChatAll("DHooksHacks = Building %d, Player %d", pThis, DHookGetParam(hParams, 1));
}
The moment an active building is struck with a wrench, the server crashes without even reaching the PrintToChatAll. I tested removing Teleporters from the list, and then the server wouldn't crash when hitting a Teleporter, even when having another building active. I've tried a few different Return Types and have put in the Handle:hReturn when necessary, but no dice. Given the specificness of the crash, it sounds like I'm on the right track. But I'm completely new to DHooks, so I just need a shove in the right direction.

Thanks in advance!
The last param is a vector not an int and the return type is a bool
__________________

Last edited by Pelipoika; 11-05-2016 at 16:10.
Pelipoika is offline
FudgePoly
Senior Member
Join Date: Jul 2011
Old 03-18-2012 , 10:37   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #6

Code:
[14] <FAILED> file "dhooks.ext.so": Could not find interface: IGameHelpers
Using TF2, fully updated, CentOS.
FudgePoly is offline
psychonic

BAFFLED
Join Date: May 2008
Old 03-18-2012 , 11:09   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #7

Quote:
Originally Posted by FudgePoly View Post
Code:
[14] <FAILED> file "dhooks.ext.so": Could not find interface: IGameHelpers
Using TF2, fully updated, CentOS.
What version of SM are you running?
psychonic is offline
FudgePoly
Senior Member
Join Date: Jul 2011
Old 03-18-2012 , 11:29   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #8

Latest stable release.
FudgePoly is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 03-18-2012 , 14:18   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #9

Quote:
Originally Posted by KyleS View Post
<KyleS> Drifter, Are you aware of any leaks in DHooks? D:
* ViolentCrimes has quit (Read error: Connection reset by peer)
<KyleS> Drifter, http://pastie.org/private/vxdnhepkmhi7wowytmydcg - If the client is kicked, if the plugin or ext is unloaded, the memory still isn't freed. I'm not sure where it's occuring. I could fire up Valgrind though if you can't reproduce it.
<KyleS> Hit about 2.5gb in 12h lol D:
I have fixed a few. There was one in the actual hooking, and another in getting the params/return values. If there is more feel free to run valgrind since I couldnt see anymore. I tried running valgrind but not sure if I did it correctly since I never used it

Quote:
Originally Posted by FudgePoly View Post
Code:
[14] <FAILED> file "dhooks.ext.so": Could not find interface: IGameHelpers
Using TF2, fully updated, CentOS.
Try 1.0.3-alpha it should be fixed.

Also anyone running anything before 1.0.3-alpha should update to it, since the memory leak was pretty big.
Dr!fter is offline
Exelent58
New Member
Join Date: Oct 2013
Old 10-26-2013 , 09:11   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #10

Quote:
Originally Posted by Dr!fter View Post
I have fixed a few. There was one in the actual hooking, and another in getting the params/return values. If there is more feel free to run valgrind since I couldnt see anymore. I tried running valgrind but not sure if I did it correctly since I never used it



Try 1.0.3-alpha it should be fixed.

Also anyone running anything before 1.0.3-alpha should update to it, since the memory leak was pretty big.
Where i can get that version of dhooks?
Error:
Code:
[SM] Unable to load plugin "sf2.smx": Required extension "dhooks" file("dhooks.ext") not running
Exelent58 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 05:33.


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