diff --git a/extensions/sdkhooks/natives.cpp b/extensions/sdkhooks/natives.cpp index b3a70d35..6cc4c431 100644 --- a/extensions/sdkhooks/natives.cpp +++ b/extensions/sdkhooks/natives.cpp @@ -175,7 +175,13 @@ cell_t Native_TakeDamage(IPluginContext *pContext, const cell_t *params) vecDamagePosition = vec3_origin; } - CTakeDamageInfoHack info(pInflictor, pAttacker, flDamage, iDamageType, pWeapon, vecDamageForce, vecDamagePosition); + int iDamageCustom = 0; + if (params[0] >= 9) + { + iDamageCustom = params[9]; + } + + CTakeDamageInfoHack info(pInflictor, pAttacker, flDamage, iDamageType, pWeapon, vecDamageForce, vecDamagePosition, iDamageCustom); SH_MCALL(pVictim, OnTakeDamage)((CTakeDamageInfoHack &)info); #endif diff --git a/extensions/sdkhooks/takedamageinfohack.cpp b/extensions/sdkhooks/takedamageinfohack.cpp index 0fdb076b..733ab77d 100644 --- a/extensions/sdkhooks/takedamageinfohack.cpp +++ b/extensions/sdkhooks/takedamageinfohack.cpp @@ -34,7 +34,7 @@ CTakeDamageInfo::CTakeDamageInfo(){} -CTakeDamageInfoHack::CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity *pAttacker, float flDamage, int bitsDamageType, CBaseEntity *pWeapon, Vector vecDamageForce, Vector vecDamagePosition ) +CTakeDamageInfoHack::CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity *pAttacker, float flDamage, int bitsDamageType, CBaseEntity *pWeapon, Vector vecDamageForce, Vector vecDamagePosition, int iDamageCustom ) { m_hInflictor = pInflictor; if ( pAttacker ) @@ -63,9 +63,9 @@ CTakeDamageInfoHack::CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity * m_iAmmoType = -1; #if SOURCE_ENGINE < SE_ORANGEBOX - m_iCustomKillType = 0; + m_iCustomKillType = iDamageCustom; #else - m_iDamageCustom = 0; + m_iDamageCustom = iDamageCustom; #endif #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_SDK2013 \ diff --git a/extensions/sdkhooks/takedamageinfohack.h b/extensions/sdkhooks/takedamageinfohack.h index abd1ac65..3db346f1 100644 --- a/extensions/sdkhooks/takedamageinfohack.h +++ b/extensions/sdkhooks/takedamageinfohack.h @@ -58,7 +58,7 @@ class CTakeDamageInfoHack : public CTakeDamageInfo { public: - CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity *pAttacker, float flDamage, int bitsDamageType, CBaseEntity *pWeapon, Vector vecDamageForce, Vector vecDamagePosition ); + CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity *pAttacker, float flDamage, int bitsDamageType, CBaseEntity *pWeapon, Vector vecDamageForce, Vector vecDamagePosition, int iDamageCustom=0); inline int GetAttacker() const { return m_hAttacker.IsValid() ? m_hAttacker.GetEntryIndex() : -1; } inline int GetInflictor() const { return m_hInflictor.IsValid() ? m_hInflictor.GetEntryIndex() : -1; } #if SOURCE_ENGINE >= SE_ORANGEBOX && SOURCE_ENGINE != SE_LEFT4DEAD diff --git a/plugins/include/sdkhooks.inc b/plugins/include/sdkhooks.inc index 07c8d9c3..cd0aec2f 100644 --- a/plugins/include/sdkhooks.inc +++ b/plugins/include/sdkhooks.inc @@ -408,10 +408,11 @@ native void SDKUnhook(int entity, SDKHookType type, SDKHookCB callback); * @param weapon Weapon index (orangebox and later) or -1 for unspecified * @param damageForce Velocity of damage force * @param damagePosition Origin of damage + * @param damageCustom User custom */ native void SDKHooks_TakeDamage(int entity, int inflictor, int attacker, float damage, int damageType=DMG_GENERIC, int weapon=-1, - const float damageForce[3]=NULL_VECTOR, const float damagePosition[3]=NULL_VECTOR); + const float damageForce[3]=NULL_VECTOR, const float damagePosition[3]=NULL_VECTOR, int damageCustom=0); /** * Forces a client to drop the specified weapon