Hi there
I'm trying to help someone out with the following. I've got this code, but it's only working on the first hit. Also, the animation isn't removed, the color just turns black.
PHP Code:
public PreDisableBlood(id)
{
if(g_bUnderstabbed[id])
{
client_print(0, print_chat, "Disable blood animation");
SetHamReturnInteger(-1);
g_bUnderstabbed[id] = false;
return HAM_HANDLED;
}
return HAM_SUPERCEDE;
}
I'll just leave the entire code for any one who needs more information.
PHP Code:
/* Sublime AMXX Editor v2.2 */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <hamsandwich>
#define PLUGIN "Anti UnderStab"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"
#if !defined DMG_GRENADE
#define DMG_GRENADE ( 1 << 24 )
#endif
#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32;
#endif
#define g_iIsPlayer(%0) (1 <= (%0) <= MAX_PLAYERS)
new bool:g_bUnderstabbed[MAX_PLAYERS + 1];
new g_pYOffset;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
RegisterHam(Ham_TakeDamage, "player", "PreTakeDamage");
RegisterHam(Ham_BloodColor, "player", "PreDisableBlood");
g_pYOffset = register_cvar("aus_offset", "20");
}
public PreTakeDamage(iVictim, iInflictor, iAttacker, Float:fDamage, iDmgBits)
{
if(!is_user_alive(iVictim) || !is_user_alive(iAttacker) || !g_iIsPlayer(iAttacker) || !g_iIsPlayer(iVictim) || iDmgBits & DMG_GRENADE)
{
return HAM_IGNORED;
}
if(cs_get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_CT && cs_get_user_team(iVictim) == CS_TEAM_T)
{
new iAttOrigin[3];
new iVicOrigin[3];
get_user_origin(iAttacker, iAttOrigin);
get_user_origin(iVictim, iVicOrigin);
iAttOrigin[2] += get_pcvar_num(g_pYOffset);
if(iVicOrigin[2] > iAttOrigin[2])
{
g_bUnderstabbed[iVictim] = true;
return HAM_SUPERCEDE;
}
}
return HAM_IGNORED;
}
public PreDisableBlood(id)
{
if(g_bUnderstabbed[id])
{
client_print(0, print_chat, "Disable blood animation");
SetHamReturnInteger(-1);
g_bUnderstabbed[id] = false;
return HAM_HANDLED;
}
return HAM_SUPERCEDE;
}
__________________