Add damageCustom argument to SDKHooks_TakeDamage native.
This commit is contained in:
parent
8c534e770b
commit
c2a86c77fd
@ -173,9 +173,15 @@ cell_t Native_TakeDamage(IPluginContext *pContext, const cell_t *params)
|
|||||||
vecDamagePosition = vec3_origin;
|
vecDamagePosition = vec3_origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
CTakeDamageInfoHack info(pInflictor, pAttacker, flDamage, iDamageType, pWeapon, vecDamageForce, vecDamagePosition);
|
int iDamageCustom = 0;
|
||||||
|
if (params[0] >= 9)
|
||||||
|
{
|
||||||
|
iDamageCustom = params[9];
|
||||||
|
}
|
||||||
|
|
||||||
if (params[0] < 9 || params[9] != 0)
|
CTakeDamageInfoHack info(pInflictor, pAttacker, flDamage, iDamageType, pWeapon, vecDamageForce, vecDamagePosition, iDamageCustom);
|
||||||
|
|
||||||
|
if (params[0] < 10 || params[9] != 0)
|
||||||
{
|
{
|
||||||
SH_MCALL(pVictim, OnTakeDamage)((CTakeDamageInfoHack&)info);
|
SH_MCALL(pVictim, OnTakeDamage)((CTakeDamageInfoHack&)info);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
CTakeDamageInfo::CTakeDamageInfo(){}
|
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;
|
m_hInflictor = pInflictor;
|
||||||
if ( pAttacker )
|
if ( pAttacker )
|
||||||
@ -64,9 +64,9 @@ CTakeDamageInfoHack::CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity *
|
|||||||
m_iAmmoType = -1;
|
m_iAmmoType = -1;
|
||||||
|
|
||||||
#if SOURCE_ENGINE < SE_ORANGEBOX
|
#if SOURCE_ENGINE < SE_ORANGEBOX
|
||||||
m_iCustomKillType = 0;
|
m_iCustomKillType = iDamageCustom;
|
||||||
#else
|
#else
|
||||||
m_iDamageCustom = 0;
|
m_iDamageCustom = iDamageCustom;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_SDK2013 \
|
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_SDK2013 \
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
class CTakeDamageInfoHack : public CTakeDamageInfo
|
class CTakeDamageInfoHack : public CTakeDamageInfo
|
||||||
{
|
{
|
||||||
public:
|
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);
|
||||||
int GetAttacker() const;
|
int GetAttacker() const;
|
||||||
void SetAttacker(CBaseEntity *pAttacker);
|
void SetAttacker(CBaseEntity *pAttacker);
|
||||||
inline int GetInflictor() const { return m_hInflictor.IsValid() ? m_hInflictor.GetEntryIndex() : -1; }
|
inline int GetInflictor() const { return m_hInflictor.IsValid() ? m_hInflictor.GetEntryIndex() : -1; }
|
||||||
|
@ -428,12 +428,13 @@ native void SDKUnhook(int entity, SDKHookType type, SDKHookCB callback);
|
|||||||
* @param weapon Weapon index (orangebox and later) or -1 for unspecified
|
* @param weapon Weapon index (orangebox and later) or -1 for unspecified
|
||||||
* @param damageForce Velocity of damage force
|
* @param damageForce Velocity of damage force
|
||||||
* @param damagePosition Origin of damage
|
* @param damagePosition Origin of damage
|
||||||
|
* @param damageCustom User custom
|
||||||
* @param bypassHooks If true, bypass SDK hooks on OnTakeDamage
|
* @param bypassHooks If true, bypass SDK hooks on OnTakeDamage
|
||||||
* @error Invalid entity, attacker, inflictor, or weapon entity.
|
* @error Invalid entity, attacker, inflictor, or weapon entity.
|
||||||
*/
|
*/
|
||||||
native void SDKHooks_TakeDamage(int entity, int inflictor, int attacker,
|
native void SDKHooks_TakeDamage(int entity, int inflictor, int attacker,
|
||||||
float damage, int damageType=DMG_GENERIC, int weapon=-1,
|
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,
|
||||||
bool bypassHooks = true);
|
bool bypassHooks = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user