Hi AM community, i have created an entity binded to a console comand and i want to add sounds to it when players are around , just it doesn't work and i don't know why, some help please
My code
PHP Code:
new const d_sounds [ ] [ ] =
{
"barnacle/bcl_alert2.wav",
"x/nih_die2.wav",
"x/x_pain1.wav",
"x/x_pain2.wav",
"x/x_pain3.wav"
}
and plugin_init
PHP Code:
register_forward ( FM_Think, "PmPSound" );
now the forward
PHP Code:
public PmPSound ( ent, channel, const sound [ ] )
{
static classname [ 32 ];
pev(ent,pev_classname,classname,31);
if(equali(classname, item_name))
{
if ( get_pcvar_num ( pCvar_sound ) )
{
new i = random ( sizeof ( d_sounds ) );
emit_sound ( ent, CHAN_VOICE, d_sounds [ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
return FMRES_SUPERCEDE;
}
}
return FMRES_IGNORED;
}
and created entity
PHP Code:
new ent = engfunc ( EngFunc_CreateNamedEntity, engfunc ( EngFunc_AllocString, "info_target" ) );
set_pev ( ent, pev_classname, item_name );
engfunc ( EngFunc_SetModel, ent, p_model );
+ the global
PHP Code:
new const item_name [ ] = "dm_pumplin"
what's wrong here ? because i hear no sound when i'm around entity.
__________________