AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   DHooks (Dynamic Hooks - Dev Preview) (https://forums.alliedmods.net/showthread.php?t=180114)

Dr!fter 03-10-2012 20:46

DHooks (Dynamic Hooks - Dev Preview)
 
1 Attachment(s)
DHooks is now included with SourceMod 1.11.6820. Previous versions are unsupported.

Please use SourceMod's issue tracker on GitHub for any new issues. :bee:


Oh no, not ANOTHER hooks extension!!!

This extension is not just ANOTHER hooks extension :P But rather allows sourcemod plugins to create their own hooks.

Note that you cannot set or get a unknown param/return's value.

As a basic note, if the return type is void there won’t be a return handle pushed to the callback. If there is no params no param handle will be pushed. If this pointer is set to ignore this won’t be pushed.

Example/Test Plugin

PHP Code:

#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <dhooks>

// int CBaseCombatCharacter::BloodColor(void)
new Handle:hBloodColor;

// bool CBaseCombatCharacter::Weapon_CanUse(CBaseCombatWeapon *)
new Handle:hHookCanUse;

// Vector CBasePlayer::GetPlayerMaxs()
new Handle:hGetMaxs;

// string_t CBaseEntity::GetModelName(void)
new Handle:hGetModelName;

// bool CGameRules::CanHaveAmmo(CBaseCombatCharacter *, int)
new Handle:hCanHaveAmmo;

// void CBaseEntity::SetModel(char  const*)
new Handle:hSetModel;

//float CCSPlayer::GetPlayerMaxSpeed()
new Handle:hGetSpeed;

//int CCSPlayer::OnTakeDamage(CTakeDamageInfo const&)
new Handle:hTakeDamage;

// bool CBaseEntity::AcceptInput(char  const*, CBaseEntity*, CBaseEntity*, variant_t, int)
new Handle:hAcceptInput;

//int CBaseCombatCharacter::GiveAmmo(int, int, bool)
new Handle:hGiveAmmo;

// CVEngineServer::ClientPrintf(edict_t *, char  const*)
new Handle:hClientPrintf;

public 
OnPluginStart()
{
    new 
Handle:temp LoadGameConfigFile("dhooks-test.games");
    
    if(
temp == INVALID_HANDLE)
    {
        
SetFailState("Why you no has gamedata?");
    }
    
    new 
offset;
    
    
offset GameConfGetOffset(temp"BloodColor");
    
hBloodColor DHookCreate(offsetHookType_EntityReturnType_IntThisPointer_CBaseEntityBloodColorPost);
    
    
offset GameConfGetOffset(temp"GetModelName");
    
hGetModelName DHookCreate(offsetHookType_EntityReturnType_StringThisPointer_CBaseEntityGetModelName);
    
    
offset GameConfGetOffset(temp"GetMaxs");
    
hGetMaxs DHookCreate(offsetHookType_EntityReturnType_VectorThisPointer_IgnoreGetMaxsPost);
    
    
offset GameConfGetOffset(temp"CanUse");
    
hHookCanUse DHookCreate(offsetHookType_EntityReturnType_BoolThisPointer_CBaseEntityCanUsePost);
    
DHookAddParam(hHookCanUseHookParamType_CBaseEntity);
    
    
offset GameConfGetOffset(temp"CanHaveAmmo");
    
hCanHaveAmmo DHookCreate(offsetHookType_GameRulesReturnType_BoolThisPointer_IgnoreCanHaveAmmoPost);
    
DHookAddParam(hCanHaveAmmoHookParamType_CBaseEntity);
    
DHookAddParam(hCanHaveAmmoHookParamType_Int);
    
    
offset GameConfGetOffset(temp"SetModel");
    
hSetModel DHookCreate(offsetHookType_EntityReturnType_VoidThisPointer_CBaseEntitySetModel);
    
DHookAddParam(hSetModelHookParamType_CharPtr);
    
    
offset GameConfGetOffset(temp"AcceptInput");
    
hAcceptInput DHookCreate(offsetHookType_EntityReturnType_BoolThisPointer_CBaseEntityAcceptInput);
    
DHookAddParam(hAcceptInputHookParamType_CharPtr);
    
DHookAddParam(hAcceptInputHookParamType_CBaseEntity);
    
DHookAddParam(hAcceptInputHookParamType_CBaseEntity);
    
DHookAddParam(hAcceptInputHookParamType_Object20DHookPass_ByVal|DHookPass_ODTOR|DHookPass_OCTOR|DHookPass_OASSIGNOP); //varaint_t is a union of 12 (float[3]) plus two int type params 12 + 8 = 20
    
DHookAddParam(hAcceptInputHookParamType_Int);
        
    
offset GameConfGetOffset(temp"GetMaxPlayerSpeed");
    
hGetSpeed DHookCreate(offsetHookType_EntityReturnType_FloatThisPointer_CBaseEntityGetMaxPlayerSpeedPost);
        
    
offset GameConfGetOffset(temp"GiveAmmo");
    
hGiveAmmo DHookCreate(offsetHookType_EntityReturnType_IntThisPointer_CBaseEntityGiveAmmo);
    
DHookAddParam(hGiveAmmoHookParamType_Int);
    
DHookAddParam(hGiveAmmoHookParamType_Int);
    
DHookAddParam(hGiveAmmoHookParamType_Bool);
        
    
offset GameConfGetOffset(temp"OnTakeDamage");
    
hTakeDamage DHookCreate(offsetHookType_EntityReturnType_IntThisPointer_CBaseEntityOnTakeDamage);
    
DHookAddParam(hTakeDamageHookParamType_ObjectPtr, -1DHookPass_ByRef);
    
    
DHookAddEntityListener(ListenType_CreatedEntityCreated);
    
    
//Add client printf hook pThis requires effort
    
StartPrepSDKCall(SDKCall_Static);
    if(!
PrepSDKCall_SetFromConf(tempSDKConf_Signature"CreateInterface"))
    {
        
SetFailState("Failed to get CreateInterface");
        
CloseHandle(temp);
    }
    
    
PrepSDKCall_AddParameter(SDKType_StringSDKPass_Pointer);
    
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_PointerVDECODE_FLAG_ALLOWNULL);
    
PrepSDKCall_SetReturnInfo(SDKType_PlainOldDataSDKPass_Plain);
    
    new 
String:iface[64];
    if(!
GameConfGetKeyValue(temp"EngineInterface"ifacesizeof(iface)))
    {
        
SetFailState("Failed to get engine interface name");
        
CloseHandle(temp);
    }
    
    new 
Handle:call EndPrepSDKCall();
    new 
Address:addr SDKCall(calliface0);
    
CloseHandle(call);
    
    if(!
addr)
    {
        
SetFailState("Failed to get engine ptr");
    }
    
    
offset GameConfGetOffset(temp"ClientPrintf");
    
hClientPrintf DHookCreate(offsetHookType_RawReturnType_VoidThisPointer_IgnoreHook_ClientPrintf);
    
DHookAddParam(hClientPrintfHookParamType_Edict);
    
DHookAddParam(hClientPrintfHookParamType_CharPtr);
    
DHookRaw(hClientPrintffalseaddr);
    
    
CloseHandle(temp);
    
}

public 
MRESReturn:Hook_ClientPrintf(Handle:hParams)
{
    new 
client DHookGetParam(hParams1);
    
decl String:buffer[1024];
    
DHookGetParamString(hParams2buffersizeof(buffer));
    
PrintToChat(client"BUFFER %s"buffer);
    return 
MRES_Ignored;
}

public 
MRESReturn:AcceptInput(pThisHandle:hReturnHandle:hParams)
{
    new 
String:command[128];
    
DHookGetParamString(hParams1commandsizeof(command));
    new 
type DHookGetParamObjectPtrVar(hParams416,ObjectValueType_Int);
    new 
String:wtf[128];
    
DHookGetParamObjectPtrString(hParams40ObjectValueType_Stringwtfsizeof(wtf));
    
PrintToServer("Command %s Type %i String %s"commandtypewtf);
    
DHookSetReturn(hReturnfalse);
    return 
MRES_Supercede;
}

public 
OnMapStart()
{
    
//Hook Gamerules function in map start
    
DHookGamerules(hCanHaveAmmotrueRemovalCB);
}

public 
OnClientPutInServer(client)
{
    
DHookEntity(hSetModelfalseclientRemovalCB);
    
DHookEntity(hHookCanUsetrueclientRemovalCB);
    
DHookEntity(hGetSpeedtrueclientRemovalCB);
    
DHookEntity(hGiveAmmofalseclient);
    
DHookEntity(hGetModelNametrueclient);
    
DHookEntity(hTakeDamagefalseclient);
    
DHookEntity(hGetMaxstrueclientRemovalCB);
    
DHookEntity(hBloodColortrueclient);
}

public 
EntityCreated(entity, const String:classname[])
{
    if(
strcmp(classname"point_servercommand") == 0)
    {
        
DHookEntity(hAcceptInputfalseentity);
    }
}

//int CCSPlayer::OnTakeDamage(CTakeDamageInfo const&)
public MRESReturn:OnTakeDamage(pThisHandle:hReturnHandle:hParams)
{
    
PrintToServer("DHooksHacks = Victim %i, Attacker %i, Inflictor %i, Damage %f"pThisDHookGetParamObjectPtrVar(hParams140ObjectValueType_Ehandle), DHookGetParamObjectPtrVar(hParams136ObjectValueType_Ehandle), DHookGetParamObjectPtrVar(hParams148ObjectValueType_Float));
    
    if(
pThis <= MaxClients && pThis && !IsFakeClient(pThis))
    {
        
DHookSetParamObjectPtrVar(hParams148ObjectValueType_Float0.0);
        
PrintToChat(pThis"Pimping your hp");
    }
}

// int CBaseCombatCharacter::GiveAmmo(int, int, bool)
public MRESReturn:GiveAmmo(pThisHandle:hReturnHandle:hParams)
{
    
PrintToChat(pThis"Giving %i of %i supress %i"DHookGetParam(hParams1), DHookGetParam(hParams2), DHookGetParam(hParams3));
    return 
MRES_Ignored;
}

// void CBaseEntity::SetModel(char  const*)
public MRESReturn:SetModel(pThisHandle:hParams)
{
    
//Change all bot skins to phoenix one
    
if(IsFakeClient(pThis))
    {
        
DHookSetParamString(hParams1"models/player/t_phoenix.mdl");
        return 
MRES_ChangedHandled;
    }
    return 
MRES_Ignored;
}

//float CCSPlayer::GetPlayerMaxSpeed()
public MRESReturn:GetMaxPlayerSpeedPost(pThisHandle:hReturn)
{
    
//Make bots slow
    
if(IsFakeClient(pThis))
    {
        
DHookSetReturn(hReturn100.0);
        return 
MRES_Override;
    }
    return 
MRES_Ignored;
}

// bool CGameRules::CanHaveAmmo(CBaseCombatCharacter *, int)
public MRESReturn:CanHaveAmmoPost(Handle:hReturnHandle:hParams)
{
    
PrintToServer("Can has ammo? %s %i"DHookGetReturn(hReturn)?"true":"false"DHookGetParam(hParams2));
    return 
MRES_Ignored;
}

// string_t CBaseEntity::GetModelName(void)
public MRESReturn:GetModelName(pThisHandle:hReturn)
{
    new 
String:returnval[128];
    
DHookGetReturnString(hReturnreturnvalsizeof(returnval));
    
    if(
IsFakeClient(pThis))
    {
        
PrintToServer("It is a bot, Model should be: models/player/t_phoenix.mdl It is %s"returnval);
    }
    
    return 
MRES_Ignored;
}

// Vector CBasePlayer::GetPlayerMaxs()
public MRESReturn:GetMaxsPost(Handle:hReturn)
{
    new 
Float:vec[3];
    
DHookGetReturnVector(hReturnvec);
    
PrintToServer("Get maxes %.3f, %.3f, %.3f"vec[0], vec[1], vec[2]);
    
    return 
MRES_Ignored;
}

// bool CBaseCombatCharacter::Weapon_CanUse(CBaseCombatWeapon *)
public MRESReturn:CanUsePost(pThisHandle:hReturnHandle:hParams)
{
    
//Bots get nothing.
    
if(IsFakeClient(pThis))
    {
        
DHookSetReturn(hReturnfalse);
        return 
MRES_Override;
    }
    return 
MRES_Ignored;
}

// int CBaseCombatCharacter::BloodColor(void)
public MRESReturn:BloodColorPost(pThisHandle:hReturn)
{
    
//Change the bots blood color to goldish yellow
    
if(IsFakeClient(pThis))
    {
        
DHookSetReturn(hReturn2);
        return 
MRES_Supercede;
    }
    return 
MRES_Ignored;
}

public 
RemovalCB(hookid)
{
    
PrintToServer("Removed hook %i"hookid);


Note: Gamerule hooks are removed OnMapEnd so you must hook them again in OnMapStart. Entity hooks are removed when the entity is removed.

Thats all there is to it! :P

Since this is a dev preview crashes can happen. I mostly tested in CS: S Windows. If you experience a crash please post the function, game, OS, and code.

Changelog:
  • 1.0.1-pre-alpha
    • Added Raw hook (allows passing class pointer)
    • Fixed certain hooks unhooking randomly.
  • 1.0.2-alpha
    • Added support for more params (new max is 10)
    • Added ability to add entity listeners (To hook OnEntityCreated and OnEntityDestroyed)
    • Changed from pre-alpha to alpha
  • 1.0.3-alpha
    • Fixed various memory leaks.
    • Fixed requiring latest gamehelpers i face
  • 1.0.4-alpha
    • Added support for Object pointer params (CTakeDamage in OnTakeDamage for example)
    • Removed the need for a removal callback when hooking (Its not mandatory now).
  • 1.0.5-alpha
    • Fixed a crash when a hook was removed that had no removal callback.
  • 1.0.6-alpha
    • Fixed a crash on newer engines.
  • 1.0.7-alpha
    • Fixed a crash with strings
    • Fixed a crash on new engines
    • Added support for CS:GO
    • Added support for edict_t
  • 1.0.8-alpha
    • Added support for getting the address of |this|
  • 1.0.9-alpha
    • Removed asserts from OnEntityCreated
  • 1.0.11-alpha
    • Made engine specific builds so that it works with tf2 again.
    • Hopefully fixed crashes in CS:GO in OnEntityCreated
    • Fixed a bug using Edict params.
    • Requires SM 1.5 and MM:S 1.9+
  • 1.0.12-alpha
    • Fixed crashing when accessing NULL pointers
    • Added native to check if a param is NULL before accessing it (DHookIsNullParam)
  • 1.0.13-alpha
    • Fixed a memory leak when unhooking entities.
    • Removed the need for gamedata by switching to SDKHooks entity listeners.
  • 2.0.0-dev
    • Added ability to handle params with a size other than 4
    • Restructed how hooking was handled
    • Fixed multiple memory leaks
    • Use SDKHooks for entity listeners
    • Remove the need for SDK specific builds
    • Updated to use AMBuild2
    • General code rewrite
    • Added mac support.
    • Automated builds!
  • 2.0.1-dev
    • Fixed not being able to read or set returns that were pointers.
    • Updated test plugin for SM 1.7+
  • 2.0.2-dev
    • Fix memory leak
  • 2.0.3-dev
    • Fix not being able to block void functions.
    • Fix not being able to change Vector params.
  • 2.0.4-dev
    • Fix raw hooks incorrectly comparing and passing incorrect callback functions.
    • Fix not being able to change Object Vector params.
  • 2.0.5-dev
    • Fix using ThrowNativeError outside of natives. (SM 1.8+)
  • 2.0.6-dev
    • Fixed not being able to set Vector return values.
  • 2.1.0-dev
    • Fixed a multitude of object param related issues.
    • Added new enum values to DHookPassFlag to be used for objects.
  • 2.1.1-dev
    • Fixed incorrectly unhooking non entity hooks in OnEntityDestroyed
    • Fixed not ending context (Thanks BoTox)
  • 2.2.0-dev
    • Fixed potential crash
    • Add support for setting callback when hooking instead of on create only (Allows creating post/pre hooks with one handle)

When installing DHooks2 make sure to remove any previous bin's of DHooks(1)

DHooks2 REQUIRES SourceMod 1.7+
hg93+ REQUIRES SourceMod 1.8+

Credits:
dvander - Helping with asm and being a huge help overall.
KyleS - Input and reviewing my shitty commits.
psychonic - Quacking and helping with buildbot along with coding questions.
asherkin - SourceHook info.
Powerlord - Debugging and fixing crashes.

Links:
Source : https://bitbucket.org/Drifter321/dhooks2
Waterfall : https://builds.alliedmods.net/drifter/waterfall
Builds : http://users.alliedmods.net/~drifter/builds/dhooks/

DHooks with detour support (credit to Peace-Maker)
https://forums.alliedmods.net/showpo...&postcount=589

donrevan 03-11-2012 05:56

Re: DHooks (Dynamic Hooks - Dev Preview)
 
I can't belive it! This is so much awesome!! It will replace nearly all my "just-a-hook-extensions" thank you for releasing this :D (did I already said this IS awesome?)

Thrawn2 03-11-2012 09:18

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Nice work!
Is being used by this.

Zephyrus 03-11-2012 11:37

Re: DHooks (Dynamic Hooks - Dev Preview)
 
ill use it with my hats plugin to hook setentitymodel, thank you, nice job

Peace-Maker 03-11-2012 13:52

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Wow, that's more than useful. I'll definetly mess with this :) Thank you!

KyleS 03-11-2012 14:42

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Your example has already done something I've been looking to do for a while now, thanks a ton Drifter!

Dreamy 03-11-2012 15:04

Re: DHooks (Dynamic Hooks - Dev Preview)
 
awsum, great job!! =)

Dr!fter 03-13-2012 20:54

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Updated the extension to add support for raw pointer address's. There is an example using CDirector for left4dead2 in the test plugin. Also fixed hooks randomly getting unhooked if they weren't entity hooks.

Dr!fter 03-17-2012 10:50

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Updated again. Full changelog is in the original post. I removed the "pre-alpha" tag and made it an alpha. Ive been getting more time to test different hooks and seems to be working good so that is the reason :P

KyleS 03-18-2012 02:01

Re: DHooks (Dynamic Hooks - Dev Preview)
 
<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:

FudgePoly 03-18-2012 10:37

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Code:

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

psychonic 03-18-2012 11:09

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Quote:

Originally Posted by FudgePoly (Post 1671199)
Code:

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

What version of SM are you running?

FudgePoly 03-18-2012 11:29

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Latest stable release.

Dr!fter 03-18-2012 14:18

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Quote:

Originally Posted by KyleS (Post 1671021)
<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 :P

Quote:

Originally Posted by FudgePoly (Post 1671199)
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.

Despirator 03-24-2012 14:52

Re: DHooks (Dynamic Hooks - Dev Preview)
 
how can i hook css SwitchTeam signature and stop it?

Dr!fter 03-24-2012 17:41

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Quote:

Originally Posted by Despirator (Post 1674909)
how can i hook css SwitchTeam signature and stop it?

Its not virtual so you cant use this method. You need to detour the function. What exactly are you trying to do? as their might be other hooks that can be used.

Despirator 03-25-2012 14:09

Re: DHooks (Dynamic Hooks - Dev Preview)
 
i want to handle players switch and stop that for certain players

thetwistedpanda 03-25-2012 14:53

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Well, you can hook manual team changes with join_team, which stops most of the issues in general. If you want to take into consideration plugin swapping or admin interference, it's relatively easy to hook player_team, set the broadcast to false, and swap them back.

Dr!fter 03-26-2012 09:23

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Quote:

Originally Posted by Despirator (Post 1675490)
i want to handle players switch and stop that for certain players

There dosnt seem to be anything virtual to do with switching teams.

Quote:

Originally Posted by thetwistedpanda (Post 1675522)
Well, you can hook manual team changes with join_team, which stops most of the issues in general. If you want to take into consideration plugin swapping or admin interference, it's relatively easy to hook player_team, set the broadcast to false, and swap them back.

Best method ^ :P

Despirator 03-26-2012 12:33

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Quote:

Originally Posted by thetwistedpanda (Post 1675522)
Well, you can hook manual team changes with join_team, which stops most of the issues in general. If you want to take into consideration plugin swapping or admin interference, it's relatively easy to hook player_team, set the broadcast to false, and swap them back.

i want to override autobalance function of the hide'n'seek's mod

thetwistedpanda 03-26-2012 13:00

Re: DHooks (Dynamic Hooks - Dev Preview)
 
jointeam* rather than join_team. Why can't you edit the mod and add an immunity feature?

Despirator 03-26-2012 13:02

Re: DHooks (Dynamic Hooks - Dev Preview)
 
i can but it's very stupid do it every time the mod updates

Peace-Maker 03-26-2012 14:33

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Quote:

Originally Posted by Despirator (Post 1676094)
i want to override autobalance function of the hide'n'seek's mod

Mh, just set sm_hns_ct_ratio to 0 if you're talking about this plugin.

Despirator 03-27-2012 03:35

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Quote:

Originally Posted by Peace-Maker (Post 1676157)
Mh, just set sm_hns_ct_ratio to 0 if you're talking about this plugin.

but i want to use autobalance but make immunity for certain players

minimoney1 04-04-2012 18:08

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Quote:

Originally Posted by Despirator (Post 1676516)
but i want to use autobalance but make immunity for certain players

Line 1747
PHP Code:

if (!g_bEnableHnS || !client || !IsClientInGame(client) || GetConVarFloat(g_hCVCTRatio) == 0.0)
{
    return 
Plugin_Continue;


Add this after that line and compile
PHP Code:

if (CheckCommandAccess(client"hns_immunity"ADMFLAG_RESERVATION))
{
    return 
Plugin_Continue;


I'm pretty sure that would work, while still not blocking the "sm_hns_ct_ratio" cvar.

Despirator 04-05-2012 05:52

Re: DHooks (Dynamic Hooks - Dev Preview)
 
I need separate plugin :/

Peace-Maker 04-05-2012 05:58

Re: DHooks (Dynamic Hooks - Dev Preview)
 
This really doesn't belong in this thread. Please post in the propriate plugin thread!

Dr!fter 04-05-2012 14:48

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Updated I added support for Object Pointer params like CTakeDamageInfo in OnTakeDamage. I will write a snippet with stocks to get and set different params for CTakeDamageInfo. Also made it optional to add a removal callback.

Here is a list of the offsets for CTakeDamageInfo as far as I can tell they are correct I did however not test all.
Spoiler

Dr!fter 04-08-2012 21:03

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Updated to 1.0.5-alpha Fixed a crash when a plugin was unloaded and a hook was active with no removal callback.

Bacardi 04-25-2012 03:11

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Typo in description ?
Code:

/* Removes an entity listener hook
 *
 * @param type                        Type listener to remove
 * @param callback                Callback to use
 *
 * @noreturn
*/
native DHookAddEntityListener(ListenType:type, ListenCB:callback);


Dr!fter 04-25-2012 13:40

Re: DHooks (Dynamic Hooks - Dev Preview)
 
EDIT: Thanks to asherkin for pointing out it was add not remove heh. Yea that is wrong ill fix it when i get home.

Since im posting here, Im working on a tutorial for DHooks to give a better explanation how it works. I hope to have it done soon.

Bacardi 04-26-2012 06:55

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Do this work HL2MP ?
DHooks extension will load HL2MP mod, but I don't get any hook outputs work... :?

Cs:s and Dod:s I can get work (Like Duck, Jump, observer, flashlight).
I'm almost sure offset's are right what I have taken.

Dr!fter 04-26-2012 09:32

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Quote:

Originally Posted by Bacardi (Post 1696684)
Do this work HL2MP ?
DHooks extension will load HL2MP mod, but I don't get any hook outputs work... :?

Cs:s and Dod:s I can get work (Like Duck, Jump, observer, flashlight).
I'm almost sure offset's are right what I have taken.

It should work. I never tested it either. Best way to confirm it works is to test hooks that you know should fire, like Think. Ill try to have a look at some point but next few weeks are very busy for me.

Dr!fter 04-28-2012 15:41

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Quote:

Originally Posted by Bacardi (Post 1696684)
Do this work HL2MP ?
DHooks extension will load HL2MP mod, but I don't get any hook outputs work... :?

Cs:s and Dod:s I can get work (Like Duck, Jump, observer, flashlight).
I'm almost sure offset's are right what I have taken.

Pyschonic was super awesome and tested hl2mp with a post think hook it worked correctly.

Bacardi 04-29-2012 00:18

Re: DHooks (Dynamic Hooks - Dev Preview)
 
god gam... throw my computer out of window soon...

*edit
Maybe something to do mine gamedata file. Plugin seems to be not getting offsets value from file like cs:s and dod:s.. wierd.

Found it :D
Gamedata have made entry hl2dm instead hl2mp

Dr!fter 05-24-2012 10:58

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Updated, fixed a crash on newer engines when trying to hook an entity.

GoD-Tony 06-22-2012 05:36

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Thanks for the help. Great extension!

Marcos 06-29-2012 19:17

Re: DHooks (Dynamic Hooks - Dev Preview)
 
@Dr!fter
Does Dhooks can hook with cssbot functions like "CCSBot::IsFriendInTheWay(Vector const *)"
I want to hook this funcion to reduce bot stuck.
Is this possible?

Dr!fter 08-17-2012 14:32

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Update released! Check the first post for the changelog :D

FaTony 08-19-2012 12:04

Re: DHooks (Dynamic Hooks - Dev Preview)
 
Only virtual functions are supported, right?


All times are GMT -4. The time now is 19:05.

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