View Single Post
mentalproblems
Junior Member
Join Date: Mar 2019
Old 09-23-2019 , 08:04   Re: Ham Damage (Knife)
Reply With Quote #20

Ok, so I modified it to "Pre".

And added the line "(iAttacker == iInflictor)"

Let's just test if this works then.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

new g_pCvarDamage

public plugin_init() {
    
register_plugin("Knife Damage Multiplier""1.0""alKapone")
    
    
RegisterHam(Ham_TakeDamage"player""Fw_TakeDamage_Pre" )
    
    
g_pCvarDamage register_cvar("rgc_knife_damage""3")
}

public 
Fw_TakeDamage_Post(iVictimiInflictoriAttackerFloat:fDamage// , bitsDamageType
{
    if (!
is_user_alive(iVictim) || !is_user_alive(iAttacker))
        return 
HAM_IGNORED
    
    
if ((get_user_weapon(iAttacker) == CSW_KNIFE) && (iAttacker == iInflictor))
    {
        
SetHamParamFloat(4fDamage get_pcvar_float(g_pCvarDamage))
        return 
HAM_HANDLED
    
}
    
    return 
HAM_IGNORED

Thanks again OciXCrom

Last edited by mentalproblems; 09-23-2019 at 08:04.
mentalproblems is offline