I am trying to insert my own painsounds into my function, but the engines painsounds are played instead, how would I stop them from playing so the ones in my function play?
PHP Code:
if(equali(className, "trigger_hurt"))
{//touching the triggerhurt, lets see what we can do..
//
if(dmc_canshout[id] < halflife_time())
{// time has passed, we can redo the pain event
new snd[24]
format(snd, charsmax(snd), "dmc/player/lburn%d.wav", random_num(1, 2))
emit_sound(id, CHAN_VOICE, snd, 0.5, ATTN_NORM, 1, PITCH_NORM);
dmc_canshout[id] = (halflife_time()+5.0)
client_print(0, print_chat, "PFN1 %s", snd);
return FMRES_HANDLED
}
else
return FMRES_SUPERCEDE;
}
PHP Code:
public DMC_TakeDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{//quake-like armor damage.
//client_print(this, print_chat, "%d %d %d [%.3f] %d", this, idinflictor, idattacker, damage, damagebits)
//new Float:health = entity_get_float(this, EV_FL_health)
//new Float:armor = entity_get_float(this, EV_FL_armorvalue)
//new Float:armortype = entity_get_float(this, EV_FL_armortype)
//client_print(this, print_chat, "%.2f health %.2f armor type %.2f", health, armor, armortype)
new watertype = entity_get_int(this, EV_INT_watertype)
if(watertype == -5)
{//in 'lava'
if(dmc_canshout[this] < halflife_time())
{//they can be hurt now.
new snd[24]
format(snd, charsmax(snd), "dmc/player/lburn%d.wav", random_num(1, 2))
emit_sound(this, CHAN_VOICE, snd, 0.5, ATTN_NORM, 1, PITCH_NORM);
dmc_canshout[this] = (halflife_time()+5.0)
client_print(0, print_chat, "PFN2 %s", snd);
}
else
return HAM_SUPERCEDE;
}
return HAM_HANDLED;
}
the 5.0 delay is simply for testing, value should be 0.5, but I am more interested with getting the sounds working than instantly dying when I step into lava.
if I cannot get this to work how I would like it to, I will just be checking the health and setting it to health-damage and returning supercede on the function (when req's are met) but id rather just only block the damage function when the entity is supposed to be switching from on/off instead of blocking it all the time.
__________________