06/11/2015, 10:20 PM
Buenas tengo un problema con el knife, me refiero que cuando pegas a un player con el cuchi la victima se relentiza un poco y quiero borrar eso, tengo este code que quita el retroceso pero no causa daño al jugador
Código:
#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >
#define MAX_DISTANCE 40
new bool:g_bRemoveBlood[ 33 ];
public plugin_init()
{
register_plugin( "Knife Damage Delay", "1.0", "H3avY Ra1n" )
RegisterHam( Ham_TakeDamage, "player", "Ham_TakeDamage_Pre", 0 );
RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_knife", "Ham_KnifeAttack_Post", 1 );
RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_knife", "Ham_KnifeAttack_Post", 1 );
RegisterHam( Ham_BloodColor, "player", "Ham_BloodColor_Pre", 0 );
}
public Ham_BloodColor_Pre( id )
{
if( g_bRemoveBlood[ id ] )
{
SetHamReturnInteger( -1 );
return HAM_SUPERCEDE;
}
return HAM_IGNORED;
}
public Ham_KnifeAttack_Post( iEntity )
{
new id = pev( iEntity, pev_owner );
new iParams[ 4 ];
iParams[ 0 ] = id;
iParams[ 1 ] = 35;
iParams[ 2 ] = DMG_SLASH;
iParams[ 3 ] = CSW_KNIFE;
set_task( 2.0, "Task_CheckDamage", _, iParams, sizeof iParams );
return HAM_IGNORED;
}
public Ham_TakeDamage_Pre( iVictim, iInflictor, iAttacker, Float:flDamage, iBits )
{
if( !is_user_alive( iAttacker ) || !is_user_alive( iVictim ) )
return HAM_IGNORED;
if( get_user_weapon( iAttacker ) == CSW_KNIFE )
{
g_bRemoveBlood[ iAttacker ] = true;
return HAM_SUPERCEDE;
}
else g_bRemoveBlood[ iAttacker ] = false;
return HAM_IGNORED;
}
public Task_CheckDamage( szParams[] )
{
new iAttacker = szParams[ 0 ];
new iDamage = szParams[ 1 ];
new iBits = szParams[ 2 ];
new iInflictor = szParams[ 3 ];
if( !is_user_alive( iAttacker ) )
return;
new iTarget, iBody;
get_user_aiming( iAttacker, iTarget, iBody, MAX_DISTANCE );
if( !is_user_alive( iTarget ) )
return;
ExecuteHam( Ham_TakeDamage, iTarget, iInflictor, iAttacker, float( iDamage ), iBits );
return;
}