Add damageCustom argument to SDKHooks_TakeDamage native.
# Conflicts: # extensions/sdkhooks/natives.cpp # plugins/include/sdkhooks.inc
This commit is contained in:
		
							parent
							
								
									142e76bd92
								
							
						
					
					
						commit
						aa2a71fc67
					
				@ -173,9 +173,15 @@ 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];
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (params[0] < 9 || params[9] != 0)
 | 
			
		||||
	CTakeDamageInfoHack info(pInflictor, pAttacker, flDamage, iDamageType, pWeapon, vecDamageForce, vecDamagePosition, iDamageCustom);
 | 
			
		||||
 | 
			
		||||
	if (params[0] < 10 || params[10] != 0)
 | 
			
		||||
	{
 | 
			
		||||
		SH_MCALL(pVictim, OnTakeDamage)((CTakeDamageInfoHack&)info);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -35,7 +35,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 )
 | 
			
		||||
@ -64,9 +64,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 \
 | 
			
		||||
 | 
			
		||||
@ -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 );
 | 
			
		||||
	int GetAttacker() const;
 | 
			
		||||
	void SetAttacker(CBaseEntity *pAttacker);
 | 
			
		||||
	inline int GetInflictor() const { return m_hInflictor.IsValid() ? m_hInflictor.GetEntryIndex() : -1; }
 | 
			
		||||
 | 
			
		||||
@ -426,12 +426,13 @@ 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
 | 
			
		||||
 * @param bypassHooks    If true, bypass SDK hooks on OnTakeDamage
 | 
			
		||||
 * @error                Invalid entity, attacker, inflictor, or weapon entity.
 | 
			
		||||
 */
 | 
			
		||||
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,
 | 
			
		||||
		bool bypassHooks = true);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user