I'm working on a mod, and I made an entity to play a sound when the model is activated. Everything works, but the sound. I used EmitSound to test, but that plays it everywhere, and I think is client-sided. My entity has radius, volume, and soundname options. Now, I'm talking about in C++. First of all, playin the sound. In my script, the file of the sound is represented by
m_iszMusic. It is a wav or mp3 file. I want the sound to be played, at the selected volume (
m_nVolume) and can only be heard in the radius (
m_flSoundradius) of the model. Then, I need the sound to be able to be stopped. The start function is
InputTurnOn and checks if the radio is already on (
m_nTurnedOn) and if it isn't, it plays the sound. Currently it looks like this:
- Code: Select all
void CFunModRadio::InputTurnOn( inputdata_t &inputData )
{
if(m_nTurnedOn)
{
return;
}
m_nTurnedOn = true;
EmitSound( m_iszMusic );
}
Whats missing is it doesn't check if the player is in the radius, and it doesn't set the volume.
Then we have the
InputTurnOff. It checks if the radio is off, if it isn't, it turns the sound off. It currently looks like this. Notice the absense of a function to turn off the sound, because I don't know how to do this.
- Code: Select all
void CFunModRadio::InputTurnOff( inputdata_t &inputData )
{
if(m_nTurnedOn == false)
{
return;
}
}
So if you can even understand my confusing explanation of my issue, then please, help me
