Thank you for your reply @Metalic.
I wish you had explained more for an easier understanding, but.. from what I can pick up, does it mean?
That the index is for players only?
In any case, I have been experimenting with the following code, and the sound and volume emits fine which solves my problem, but.. it creates a
new issue, the sound is not emitted the way it is with [speak]. For example :
With [emit_sound] the ambience sound file emits sounds from different speakers at varying distances. If I face a certain direction, the sound emits from one of my speakers while the other remains silent. The same happens if I face the opposite of that direction. And I am left with only able to hear the rain sound at equal volume from both speakers facing only two opposing directions, while as I turn with mouse the sound switches speakers.
What I would like to achieve is, the sound coming equally from both speakers for all clients as the way speak command handles it?
PHP Code:
#include <amxmodx>
public plugin_init(){
register_plugin("Volume Control", "1.0", "SKLS");
register_clcmd("say a","volume_a");
register_clcmd("say s","volume_s");
register_clcmd("say d","volume_stop");
register_clcmd("say f","volume_emitt");
}
public plugin_precache(){
precache_sound("ambience/rain.wav");
precache_sound("ambience/thunder_clap.wav");
//weather_ent = CREATE_ENTITY("env_rain")
}
public volume_a(){
emit_sound (32, CHAN_STREAM, "ambience/rain.wav", 0.3, ATTN_NONE, 0, PITCH_NORM);
//client_cmd(0, "speak ambience/rain.wav",10);
return PLUGIN_HANDLED;
}
public volume_s(){
emit_sound (32, CHAN_BODY, "ambience/rain.wav", 0.3, ATTN_NONE, 0, PITCH_NORM);
//client_cmd(0, "speak ambience/rain(v1)");
return PLUGIN_HANDLED;
}
public volume_stop(){
client_cmd(0, "stopsound");
return PLUGIN_HANDLED;
}
public volume_emitt(){
emit_sound (32, CHAN_STATIC, "ambience/rain.wav", 0.3, ATTN_NONE, 0, PITCH_NORM);
return PLUGIN_HANDLED;
//emit_sound ( index, channel, const sample[], Float:vol, Float:att, flags, pitch );
}
The channels, (BODY/STREAM/STATIC), does not have any effect on the outcome. And if I change the value of ATTN to anything but NONE, the sound is not emitted.