Raised This Month: $ Target: $400
 0% 

DHooks (Dynamic Hooks - Dev Preview)


Post New Thread Reply   
 
Thread Tools Display Modes
Amroth
Senior Member
Join Date: Apr 2013
Location: /root
Old 09-13-2014 , 11:47   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #241

Quote:
Originally Posted by SanKen View Post
anyone can confirm working on new update CS GO ?
Yes, working.
Amroth is offline
TheAdamRichter
New Member
Join Date: Sep 2014
Old 09-13-2014 , 21:16   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #242

Please ignore this or read my solution on the end.

//Hey guys!

//I read that it should work with the new CS:GO update but unfortunately it does not work for me. The "__dynamic_cast" error appears.
//I have those on my Linux server:

//MM: 1.11.0-git947
//SM: 1.7.0-git4886
//Dhooks: dhooks-2.0.0-hg64-linux

//Any ideas what could i have wrong?

I have just copied the dhooks2 over the old one i thought it would over write it. As i noticed this i deleted the old files and now it runs perfectly.

Last edited by TheAdamRichter; 09-13-2014 at 21:50. Reason: IT WORKS!
TheAdamRichter is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 09-13-2014 , 21:42   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #243

Quote:
Originally Posted by TheAdamRichter View Post
Hey guys!

I read that it should work with the new CS:GO update but unfortunately it does not work for me. The "__dynamic_cast" error appears.
I have those on my Linux server:

MM: 1.11.0-git947
SM: 1.7.0-git4886
Dhooks: dhooks-2.0.0-hg64-linux

Any ideas what could i have wrong?
You very likely have dhoks1 bin's still installed make sure to delete all dhooks bins then install dhooks2
Dr!fter is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-22-2014 , 17:35   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #244

Oh yeah, I never did rebuild DHooks 1.9 (aka 2.0 pre-1.7) with the CS:GO -lstdc++ fix. Whoops, here you go.

The CS:GO version is larger than before because it now relies on CS:GO's stdc++ library, much like SourceMod itself does.
Attached Files
File Type: zip dhooks-1.9 src.zip (49.3 KB, 305 views)
File Type: zip dhooks-1.9.zip (1.48 MB, 842 views)
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
JoB2C
AlliedModders Donor
Join Date: Jan 2014
Location: France
Old 09-22-2014 , 18:11   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #245

Thanks!!!
JoB2C is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 11-17-2014 , 13:29   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #246

Dumb question, what happens if I have two plugins that both hook the same thing and both try to do MRES_ChangedHandled?
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 11-17-2014 at 13:31.
Powerlord is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 12-12-2014 , 10:16   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #247

If you're trying to compile against DHooks using a recent SM 1.7 compiler, you may have noticed that it tosses compile errors in dhooks.inc.

This is because "this" is now a keyword in SourceMod and can't be used. The attached file renames all instances of "this" to "thisPointer".
Attached Files
File Type: inc dhooks.inc (16.0 KB, 235 views)
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 12-12-2014 at 10:16.
Powerlord is offline
x6herbius
Senior Member
Join Date: May 2011
Location: West Sussex, UK
Old 01-18-2015 , 15:56   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #248

I'm currently having some problems with the DHooks hooks not being fired. My plugin used to work fine but it stopped working recently and I've found that the code for the hook is not run at all. To test this I created the following small plugin:

PHP Code:
#include <sourcemod>
#include <tf2>
#include <sdktools>
#include <dhooks>
#include <tf2_stocks>

#pragma semicolon 1

new Handle:hDamageHook INVALID_HANDLE;
new 
Handle:hDamageHook2 INVALID_HANDLE;
new 
Handle:hSpawnHook INVALID_HANDLE;
new 
ofAttacker;
new 
ofInflictor;
new 
ofDamage;
//new ofDamageType;
new ofWeapon;
new 
ofDamageForce;
new 
ofDamagePosition;
new 
ofDamageCustom;

public 
Plugin:myinfo 
{
    
name "DHooks Test",
    
author "X6Herbius",
    
description "DHooks test",
    
version "0.0.0.1",
    
url "nope.avi"
}

public 
OnPluginStart()
{
    new 
Handle:gamedata LoadGameConfigFile("tfbiohazard.offsets"); 
    if ( 
gamedata == INVALID_HANDLE SetFailState("Offset gamedata file not found.");
    
    new 
offset GameConfGetOffset(gamedata"OnTakeDamage_Alive");
    new 
offset2 GameConfGetOffset(gamedata"OnTakeDamage");
    new 
offset3 GameConfGetOffset(gamedata"Spawn");
    
    
hDamageHook DHookCreate(offsetHookType_EntityReturnType_IntThisPointer_CBaseEntityOnTakeDamage_Alive);
    
DHookAddParam(hDamageHookHookParamType_ObjectPtr);
    
    
hDamageHook2 DHookCreate(offset2HookType_EntityReturnType_IntThisPointer_CBaseEntityOnTakeDamage);
    
DHookAddParam(hDamageHook2HookParamType_ObjectPtr);
    
    
hSpawnHook DHookCreate(offset3HookType_EntityReturnType_VoidThisPointer_CBaseEntityOnSpawn);
    
    
ofAttacker GameConfGetOffset(gamedata"m_hAttacker");
    
ofInflictor GameConfGetOffset(gamedata"m_hInflictor");
    
ofDamage GameConfGetOffset(gamedata"m_flDamage");
    
//ofDamageType = GameConfGetOffset(gamedata, "m_iAmmoType");
    
ofWeapon GameConfGetOffset(gamedata"m_hWeapon");
    
ofDamageForce GameConfGetOffset(gamedata"m_vecDamageForce");
    
ofDamagePosition GameConfGetOffset(gamedata"m_vecDamagePosition");
    
ofDamageCustom GameConfGetOffset(gamedata"m_iDamageCustom");
    
    
CloseHandle(gamedata);
    
    
PrintToChatAll("OnTakeDamage_Alive offset: %d Hook handle: %d (Invalid = %d)"offsethDamageHookINVALID_HANDLE);
    
PrintToChatAll("OnTakeDamage offset: %d Hook handle: %d (Invalid = %d)"offset2hDamageHook2INVALID_HANDLE);
    
PrintToChatAll("Spawn offset: %d Hook handle: %d (Invalid = %d)"offset3hSpawnHookINVALID_HANDLE);
    
PrintToChatAll("===== Offsets =====");
    
PrintToChatAll("Attacker: %d"ofAttacker);
    
PrintToChatAll("Inflictor: %d"ofInflictor);
    
PrintToChatAll("Damage: %d"ofDamage);
    
PrintToChatAll("Weapon: %d"ofWeapon);
    
PrintToChatAll("Damage force: %d"ofDamageForce);
    
PrintToChatAll("Damage position: %d"ofDamagePosition);
    
PrintToChatAll("Damage custom: %d"ofDamageCustom);
}

public 
MRESReturn:OnTakeDamage_Alive(thisPointerHandle:hReturnHandle:hParams)
{
    
PrintToChatAll("OnTakeDamage_Alive called");
    
LogMessage("OnTakeDamage_Alive called");
    return 
MRES_Ignored;
}

public 
MRESReturn:OnTakeDamage(thisPointerHandle:hReturnHandle:hParams)
{
    
PrintToChatAll("OnTakeDamage callled");
    
LogMessage("OnTakeDamage callled");
    return 
MRES_Ignored;
}

public 
MRESReturn:OnSpawn(thisPointerHandle:hReturnHandle:hParams)
{
    
PrintToChatAll("Spawn called for %d"thisPointer);
    
LogMessage("Spawn called for %d"thisPointer);
    return 
MRES_Ignored;

The offsets from the gamedata are 271, 62 and 22 respectively on Windows. I'm using DHooks 2 and SM 1.7, and although the handles are reported as successful from in-game none of the messages from their respective hook functions appear. Am I doing something wrong?
x6herbius is offline
Send a message via Skype™ to x6herbius
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 01-18-2015 , 22:56   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #249

The reason why the sample plugin doesnt fire any hook is because you dont hook anything. As for the crash I'd bet its related to the offset for OnTakeDamage_Alive being wrong.
Dr!fter is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 01-18-2015 , 22:57   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #250

SDKHooks already hooks OnTakeDamage in all versions and OnTakeDamage_Alive in SM 1.7.
__________________
Not currently working on SourceMod plugin development.
Powerlord 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 10:38.


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