View Single Post
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 08-23-2012 , 19:03   Re: [IDA/DHooks]How to get vtable offsets
Reply With Quote #9

Quote:
Originally Posted by K.K.Lv View Post
how to get the offset of the object ?
code from your tut about DHooks:
Code:
public MRESReturn:OnTakeDamage(this, Handle:hReturn, Handle:hParams) {     PrintToServer("DHooksHacks = Victim %i, Attacker %i, Inflictor %i, Damage %f", this, DHookGetParamObjectPtrVar(hParams, 1, 40, ObjectValueType_Ehandle), DHookGetParamObjectPtrVar(hParams, 1, 36, ObjectValueType_Ehandle), DHookGetParamObjectPtrVar(hParams, 1, 48, ObjectValueType_Float));         if(this <= MaxClients && this > 0 && !IsFakeClient(this))     {         DHookSetParamObjectPtrVar(hParams, 1, 48, ObjectValueType_Float, 0.0);         PrintToChat(this, "Pimping your hp");     } }
Its math, the class for CTakeDamageInfo is in the sdk so its easier https://mxr.alliedmods.net/hl2sdk-cs...mageinfo.h#112

The size of a vector is 16 EHANDLE is 4 and float is 4 So the values start from 0.

Vector m_vecDamageForce; //0
Vector m_vecDamagePosition; //12
Vector m_vecReportedPosition; //24
EHANDLE m_hInflictor; //36
EHANDLE m_hAttacker; //40
EHANDLE m_hWeapon; //44
float m_flDamage; //48
float m_flMaxDamage; //52
float m_flBaseDamage; //56
int m_bitsDamageType; //60
int m_iDamageCustom; //64
int m_iDamageStats; //68
int m_iAmmoType; //72
int m_iDamagedOtherPlayers; //76
int m_iPlayerPenetrateCount; //80

Last edited by Dr!fter; 04-23-2015 at 15:44.
Dr!fter is offline