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

DHooks (Dynamic Hooks - Dev Preview)


Post New Thread Reply   
 
Thread Tools Display Modes
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 06-12-2019 , 11:23   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #681

Quote:
Originally Posted by nosoop View Post
Cool; I'll trim down the code and make sure it's reproducible.



You might be able to allocate a CTakeDamageInfo on the SourcePawn stack as an int[], or you could try passing in a pointer from Source Scramble's MemoryBlock handle. Haven't taken an in-depth look at either approach. I'd say both are absolutely filthy hacks.

You can get info with DHook OnTakeDamage with an objectptr passed in byref, then get the information with DHookGetParamObjectPtrVar.
SM-TFOnTakeDamage implements that.
Oh lord, I'm working with that stuff for the first time. I'm a bit lost.
Shadowysn is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 06-12-2019 , 20:01   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #682

Quote:
Originally Posted by Shadowysn View Post
Oh lord, I'm working with that stuff for the first time. I'm a bit lost.
For the second, DHooks-relevant bit, most of the important stuff is located in the dhook_takedamageinfo.inc file. Those offsets are based on the layout of CTakeDamageInfo in the SDK.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
Had3s99
Member
Join Date: Sep 2015
Location: France
Old 06-13-2019 , 12:45   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #683

Hello,

I use Sourcemod (build 1.10.0.6425) and Dhooks doesn't work with this, i need this build for shavit's plugin so if u can help me that will be nice ;)
Had3s99 is offline
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 06-14-2019 , 09:07   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #684

Quote:
Originally Posted by nosoop View Post
For the second, DHooks-relevant bit, most of the important stuff is located in the dhook_takedamageinfo.inc file. Those offsets are based on the layout of CTakeDamageInfo in the SDK.
Welp, didn't succeed. All I did was find another way to crash the game with a ragdoll signature.
Here's the dhook:
PHP Code:
public MRESReturn OnTakeDamage(clientHandle hReturnHandle hParams)
{
    
PrintToServer("DHooksHacks = Victim %i, Attacker %i, Inflictor %i, Damage %f"clientDHookGetParamObjectPtrVar(hParams140ObjectValueType_Ehandle), DHookGetParamObjectPtrVar(hParams136ObjectValueType_Ehandle), DHookGetParamObjectPtrVar(hParams148ObjectValueType_Float));
    
    if (!
IsValidEntity(client) || !IsClientInGame(client) || (GetClientTeam(client) != && GetClientTeam(client) != && GetClientTeam(client) != 4))
    return 
MRES_Ignored;
    
    
/*if(client <= MaxClients && client > 0 && !IsFakeClient(client))
    {
        DHookSetParamObjectPtrVar(hParams, 1, 48, ObjectValueType_Float, 0.0);
        PrintToChat(client, "Pimping your hp");
    }*/
    
float damageForce[3], damagePosition[3], damageReportedPosition[3];
    
DHookGetParamObjectPtrVarVector(hParams112ObjectValueType_VectordamageForce);
    
DHookGetParamObjectPtrVarVector(hParams112ObjectValueType_VectordamagePosition);
    
DHookGetParamObjectPtrVarVector(hParams124ObjectValueType_VectordamageReportedPosition);
    
    
int inflictor DHookGetParamObjectPtrVar(hParams136ObjectValueType_Ehandle);
    
int attacker DHookGetParamObjectPtrVar(hParams136ObjectValueType_Ehandle);
    
int weapon DHookGetParamObjectPtrVar(hParams136ObjectValueType_Ehandle);
    
    
float flDamage DHookGetParamObjectPtrVar(hParams136ObjectValueType_Float);
    
float bitsDamageType DHookGetParamObjectPtrVar(hParams136ObjectValueType_Int);
    
float damagecustom DHookGetParamObjectPtrVar(hParams136ObjectValueType_Int);
    
    
//Action result = CallOnTakeDamage(victim, attacker, inflictor, flDamage, 
    //bitsDamageType, weapon, damageForce, damagePosition, damagecustom);
    
Call_StartForward(g_FwdOnTakeDamage); // There is already a forward defined in OnPluginStart, and it's the same forward in the TF2 CTakeDamageInfo scripting file minus the CritType.
    
Call_PushCell(client);
    
Call_PushCellRef(attacker);
    
Call_PushCellRef(inflictor);
    
Call_PushFloatRef(flDamage);
    
Call_PushCellRef(bitsDamageType);
    
Call_PushCellRef(weapon);
    
Call_PushArrayEx(damageForce3SM_PARAM_COPYBACK);
    
Call_PushArrayEx(damagePosition3SM_PARAM_COPYBACK);
    
Call_PushCell(damagecustom);
    
    
Action result;
    
Call_Finish(result);
    
    
SDKCall(hCreateRagdollclientresult);
    
    
//g_DamageInfo[client] = result;
    
    
return MRES_Ignored;


Last edited by Shadowysn; 06-14-2019 at 09:12.
Shadowysn is offline
Addie
Junior Member
Join Date: Nov 2018
Old 07-08-2019 , 00:25   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #685

I am having issues with the experimental detours branch.
Game is No More Room in Hell and I'm returning MRES_Supercede on a void function.

PHP Code:
void __cdecl Bot_RunAllvoid 
The detour fires, but so does the real function.

Could this be a bug, or am I doing something wrong?

My code:

Spoiler


My gamedata:

Spoiler


Output:
Code:
Bot_RunAll detoured!
Detouring..
Bot kicked by server. (caused by the real function)
For some context, Bot_RunAll() is called by GameStartFrame(), and kicks any bots it finds. My code tries to stop that.

Last edited by Addie; 07-08-2019 at 00:32.
Addie is offline
xXDeathreusXx
Veteran Member
Join Date: Mar 2013
Location: pPlayer->GetOrigin();
Old 07-08-2019 , 15:27   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #686

Hook post too, just incase
__________________
Plugins|Profile
Requests closed

I'm a smartass by nature, get used to it
xXDeathreusXx is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 07-08-2019 , 18:27   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #687

Are you sure the function you're trying to block is the one causing the bots to be kicked? I don't see why the original function wouldn't be skipped.
__________________
Peace-Maker is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 07-08-2019 , 19:22   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #688

https://forums.alliedmods.net/showthread.php?t=317327

This is why cross-posting is against the rules.
__________________
asherkin is offline
Addie
Junior Member
Join Date: Nov 2018
Old 07-08-2019 , 22:33   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #689

Quote:
Originally Posted by Peace-Maker View Post
Are you sure the function you're trying to block is the one causing the bots to be kicked?
I'm pretty sure yes. With my detour still active, I hooked UTIL_VarArgs("kickid %d\n", int) as well, which is a unique call done by Bot_RunAll(), it fired normally.

Quote:
Originally Posted by asherkin View Post
This is why cross-posting is against the rules.
Apologies, my only reason for crossposting was to notify the author of a potential issue with the library.
I'll go ahead and find another function to skip for now. Just thought this was odd.

Last edited by Addie; 07-08-2019 at 22:36.
Addie is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 07-21-2019 , 11:25   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #690

My friend says: DHookSetParamString might be bugged for detours in 2.2.0

Test case:
https://gist.github.com/hydrogen-mvm...893ed4d0a01736
__________________

Last edited by Pelipoika; 07-21-2019 at 11:26.
Pelipoika 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:36.


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