I tested following code. I want to trigger at any time calling "CAmbientGeneric::ToggleUse" (force_use or Ham_Use), but for some reason it's not working; The sound it's emitted properly without spawnflag SF_AMBIENT_SOUND_NOT_LOOPING but I can't toggle it on/off.
Code:
#define BIT(%0) (1<<%0)
#define SF_AMBIENT_SOUND_EVERYWHERE BIT(0)
#define SF_AMBIENT_SOUND_NOT_LOOPING BIT(5)
[...]
public plugin_precache()
{
new pAmbient = create_entity("ambient_generic");
entity_set_int(pAmbient, EV_INT_spawnflags, SF_AMBIENT_SOUND_EVERYWHERE|SF_AMBIENT_SOUND_NOT_LOOPING);
entity_set_string(pAmbient, EV_SZ_message, "ambience/Opera.wav");
entity_set_float(pAmbient, EV_FL_health, 10.0);
DispatchSpawn(pAmbient);
force_use(pAmbient, pAmbient);
}
__________________