Quote:
Originally Posted by HowToRuski
Thanks. Did it work for you? Because for me still not...
|
yes also in this way
PHP Code:
public plugin_init()
{
register_forward(FM_EmitSound, "fw_emit_sound_post", 1)
//..
}
public fw_emit_sound_post(ent, channel, const sample[])
{
for(new i;i < 3;i++)
{
static eSound[20]; formatex(eSound, charsmax(eSound), "weapons/debris%d.wav", i+1)
if(equal(sample, eSound))
{
if( !IsHeGrenade(ent) )
return FMRES_IGNORED
GrenadeExploded(ent)
}
}
return FMRES_IGNORED
}
stock GrenadeExploded(ent)
{
// get origin of explosion
new Float:origin[3];
//pev(greindex,pev_origin,origin);
entity_get_vector(ent, EV_VEC_origin, origin)
// get color from cvar
new color[16];
get_pcvar_string(color_cvar,color,charsmax(color));
// split it into red, green, blue
new redamt[5], greenamt[5], blueamt[5];
parse(color,redamt,4,greenamt,4,blueamt,4);
// send the light flash
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(27); // TE_DLIGHT
write_coord(floatround(origin[0])); // x
write_coord(floatround(origin[1])); // y
write_coord(floatround(origin[2])); // z
write_byte(get_pcvar_num(radius_cvar)); // radius
write_byte(str_to_num(redamt)); // r
write_byte(str_to_num(greenamt)); // g
write_byte(str_to_num(blueamt)); // b
write_byte(8); // life
write_byte(60); // decay rate
message_end();
}
__________________