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

DHooks (Dynamic Hooks - Dev Preview)


Post New Thread Reply   
 
Thread Tools Display Modes
Technoblazed
Senior Member
Join Date: May 2016
Location: United Kingdom
Old 08-18-2017 , 21:21   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #561

Quote:
Originally Posted by Neuro Toxin View Post
We have.
Anything directly dhooks related? Am using the most recent gamedata from the normal sourcemod repos.
Technoblazed is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 08-19-2017 , 05:37   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #562

Quote:
Originally Posted by Technoblazed View Post
Anything directly dhooks related? Am using the most recent gamedata from the normal sourcemod repos.
For the umpteenth million time, it is the plugins that use dhooks that provide the gamedata, not dhooks. Dhooks doesn't break on updates, the plugins using it do - test them individually and post in their threads, not here.
__________________
asherkin is offline
Agent Wesker
Senior Member
Join Date: Apr 2012
Old 09-04-2017 , 14:44   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #563

I use dhooks to capture ambient_generics so clients can control map sounds (see plugin here)

The problem is any map that uses the kill input on these entities, the server crashes immediately when the hooked entity is removed... Any ideas?

Last edited by Agent Wesker; 09-04-2017 at 14:44.
Agent Wesker is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 09-04-2017 , 15:30   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #564

Quote:
Originally Posted by Agent Wesker View Post
I use dhooks to capture ambient_generics so clients can control map sounds (see plugin here)

The problem is any map that uses the kill input on these entities, the server crashes immediately when the hooked entity is removed... Any ideas?
What version are you using? This was fiixed in the newer builds. Its because you hook AcceptEntityInput and when "kill" is the input it unhooked it mid hook so it crashed. But that was fixed over a year ago.
Dr!fter is offline
Agent Wesker
Senior Member
Join Date: Apr 2012
Old 09-04-2017 , 16:04   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #565

Quote:
Originally Posted by Dr!fter View Post
What version are you using? This was fiixed in the newer builds. Its because you hook AcceptEntityInput and when "kill" is the input it unhooked it mid hook so it crashed. But that was fixed over a year ago.
I'm not sure where to check the version but it's dated 20/12/2016 so probably 2.1.1:

http://users.alliedmods.net/~drifter...20-windows.zip

Last edited by Agent Wesker; 09-04-2017 at 16:21.
Agent Wesker is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 09-05-2017 , 07:04   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #566

Quote:
Originally Posted by Agent Wesker View Post
I'm not sure where to check the version but it's dated 20/12/2016 so probably 2.1.1:

http://users.alliedmods.net/~drifter...20-windows.zip
sm exts list should show you the version. If that is the case then something is broken still.
Dr!fter is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 09-05-2017 , 07:38   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #567

I tested with this on CS:S and it worked fine.

PHP Code:
#include <sdktools>
#pragma semicolon 1
#include <cstrike>
#include <dhooks>

Handle hAcceptInput;

public 
OnPluginStart()
{
    
RegConsoleCmd("sm_kill"SM_Kill);
    
    
hAcceptInput DHookCreate(36HookType_EntityReturnType_BoolThisPointer_CBaseEntityAcceptInput);
    
DHookAddParam(hAcceptInputHookParamType_CharPtr);
    
DHookAddParam(hAcceptInputHookParamType_CBaseEntity);
    
DHookAddParam(hAcceptInputHookParamType_CBaseEntity);
    
DHookAddParam(hAcceptInputHookParamType_Object20);
    
DHookAddParam(hAcceptInputHookParamType_Int);
}

public 
Action SM_Kill(clientargc)
{
    for (new 
MaxClients<= GetMaxEntities(); i++)
    {
        if (
IsValidEdict(i) && IsValidEntity(i))
        {
            
decl String:name[80];
            
GetEdictClassname(inamesizeof(name));
            if((
strncmp(name"weapon_"7false) == || strncmp(name"item_"5false) == 0) && GetEntPropEnt(iProp_Data"m_hOwnerEntity") == -1)
                
AcceptEntityInput(i"Kill");
        }
    }
}

public 
MRESReturn AcceptInput(int entityHandle hReturnHandle hParams)
{
    
char command[128];
    
DHookGetParamString(hParams1commandsizeof(command));
    
    
PrintToServer("Entity %i got %s"entitycommand);
    
    return 
MRES_Ignored;
}

public 
OnEntityCreated(int entity, const char[] classname)
{
    if(
StrEqual(classname"weapon_deagle"))
    {
        
DHookEntity(hAcceptInputfalseentity);
    }

You can try logging the command to see what it crashes on perhaps or getting a crash dump.
Dr!fter is offline
Agent Wesker
Senior Member
Join Date: Apr 2012
Old 09-05-2017 , 12:00   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #568

Quote:
Originally Posted by Dr!fter View Post
I tested with this on CS:S and it worked fine.

PHP Code:
#include <sdktools>
#pragma semicolon 1
#include <cstrike>
#include <dhooks>

Handle hAcceptInput;

public 
OnPluginStart()
{
    
RegConsoleCmd("sm_kill"SM_Kill);
    
    
hAcceptInput DHookCreate(36HookType_EntityReturnType_BoolThisPointer_CBaseEntityAcceptInput);
    
DHookAddParam(hAcceptInputHookParamType_CharPtr);
    
DHookAddParam(hAcceptInputHookParamType_CBaseEntity);
    
DHookAddParam(hAcceptInputHookParamType_CBaseEntity);
    
DHookAddParam(hAcceptInputHookParamType_Object20);
    
DHookAddParam(hAcceptInputHookParamType_Int);
}

public 
Action SM_Kill(clientargc)
{
    for (new 
MaxClients<= GetMaxEntities(); i++)
    {
        if (
IsValidEdict(i) && IsValidEntity(i))
        {
            
decl String:name[80];
            
GetEdictClassname(inamesizeof(name));
            if((
strncmp(name"weapon_"7false) == || strncmp(name"item_"5false) == 0) && GetEntPropEnt(iProp_Data"m_hOwnerEntity") == -1)
                
AcceptEntityInput(i"Kill");
        }
    }
}

public 
MRESReturn AcceptInput(int entityHandle hReturnHandle hParams)
{
    
char command[128];
    
DHookGetParamString(hParams1commandsizeof(command));
    
    
PrintToServer("Entity %i got %s"entitycommand);
    
    return 
MRES_Ignored;
}

public 
OnEntityCreated(int entity, const char[] classname)
{
    if(
StrEqual(classname"weapon_deagle"))
    {
        
DHookEntity(hAcceptInputfalseentity);
    }

You can try logging the command to see what it crashes on perhaps or getting a crash dump.
sm ext list shows 2.1.1

Are you able to test with CS:GO by any chance?

I will PM you my crash log.
Agent Wesker is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 09-05-2017 , 12:57   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #569

Quote:
Originally Posted by Agent Wesker View Post
sm ext list shows 2.1.1

Are you able to test with CS:GO by any chance?

I will PM you my crash log.
You are likely getting or accessing NULL or something of that sort.

You appear to crash here
DHookGetParamObjectPtrString(hParams, 4, 0, ObjectValueType_String, eParam, sizeof(eParam));

which likely means that the value actually isnt a string and its trying to do some weird stuff.

Then you do
StringToInt(eParam)

is it a string or is it an int? you can get the objectptrvar as an int.

Edit:
You can get the field type as well from the object. if you set the 0 to 16 i think.
https://github.com/ValveSoftware/sou...ariant_t.h#L24 thats the object.

the field types

https://github.com/ValveSoftware/sou.../datamap.h#L28

Last edited by Dr!fter; 09-05-2017 at 13:03.
Dr!fter is offline
Agent Wesker
Senior Member
Join Date: Apr 2012
Old 09-05-2017 , 19:16   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #570

Quote:
Originally Posted by Dr!fter View Post
You are likely getting or accessing NULL or something of that sort.

You appear to crash here
DHookGetParamObjectPtrString(hParams, 4, 0, ObjectValueType_String, eParam, sizeof(eParam));

which likely means that the value actually isnt a string and its trying to do some weird stuff.

Then you do
StringToInt(eParam)

is it a string or is it an int? you can get the objectptrvar as an int.

Edit:
You can get the field type as well from the object. if you set the 0 to 16 i think.
https://github.com/ValveSoftware/sou...ariant_t.h#L24 thats the object.

the field types

https://github.com/ValveSoftware/sou.../datamap.h#L28
That fixed it, when the "kill" input is sent the parameter is "void" type which caused a crash...

When an actual input is sent it's a string or if no parameter is set its a float for some reason.

Thank you so much.

Last edited by Agent Wesker; 09-05-2017 at 19:16.
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 10:49.


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