View Single Post
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