Hi, I have a problem and I don't know why this doesn't work. before I could make it work with the same code but now it doesn't, and I didn't change anything.
is there something wrong with the code?
PHP Code:
// this is just to be activated during the dash
new bool:touchAceKatanaPower[SH_MAXSLOTS+1]
//----------------------------------------------------------------------------------------------
public sh_client_death(victim, attacker)
{
if ( victim == attacker ) return
new randnum = random_num(0, 100)
new katanachance = floatround(get_pcvar_float(pcvarPercent) * 100)
new clip, ammo, wpnid = get_user_weapon(attacker, clip, ammo)
if ( wpnid == CSW_KNIFE && katanachance >= randnum && is_user_alive(attacker) ) {
dash(attacker)
new ptr = attacker
new ptd = victim
pfn_touch(ptr, ptd)
}
}
//----------------------------------------------------------------------------------------------
// EVENT of DASH + DAMAGE
//----------------------------------------------------------------------------------------------
public dash(attacker)
{
if (!(pev(attacker, pev_flags) & FL_ONGROUND)) return
static Float:velocity[3]
velocity_by_aim(attacker, 1750, velocity)
velocity[2] = 100.0 // z
set_pev(attacker, pev_velocity, velocity)
touchAceKatanaPower[attacker] = true
}
//-----------------------------------------
public pfn_touch(ptr, ptd)
{
if(!is_valid_ent(ptr) || !is_valid_ent(ptd)) return PLUGIN_CONTINUE
if(!is_user_alive(ptr) || !is_user_alive(ptd)) return PLUGIN_CONTINUE
new classname[32]
entity_get_string(ptr, EV_SZ_classname, classname, 31)
if ( equal(classname, "player") ) {
if ( touchAceKatanaPower[ptr] && get_user_team(ptr) != get_user_team(ptd) ) {
// This code is for kill
new damage = read_data(2)
sh_extra_damage(ptd, ptr, damage, "Por Katana", 0, SH_DMG_KILL)
}
}
return PLUGIN_HANDLED
}