Hello again everyone,
my friend tries to use sounds from combat arms game in Team Fortress 2, so far all the sounds work except one specific wav sound. The problematic sound is rollingup.wav. Things we've done so far:
- Precache the sound
- Add to download table
- We can hear the sound using sm_play command, but using EmitSound(ToAll) fails miserably(sm_play is not reliable command for testing sounds, sadly, because it uses playgamesound)
- We've added characters like #, @ and ) in front of the sound path, but sound doesn't play
- We sv_cheats and snd_show 1 and the sound shows there but we don't hear it
- We've checked the code and i'm 100% sure it's not the problem(tested with other sound and it worked)
- We've converted the problematic sound from mono to stereo, still not working
We've tried many thing and sound not working at all
Files:
rollingup.wav - the original sound
not working
fix_rollingup_v4.wav - rollingup.wav sound but converted to stereo
not working
rollingdown.wav - another sound we use
working, it's here for comparison with the broken sound
Part of our code, part of it is taken from be the giant deflector heavy plugin:
PHP Code:
#define SOUND_GUNFIRE "combat_arms/new_fire_fix.wav"
#define SOUND_GUNSPIN "mvm/giant_heavy/giant_heavy_gunspin.wav"
#define SOUND_WINDUP "combat_arms/rollingup.wav"
#define SOUND_WINDDOWN "combat_arms/rollingdown.wav"
public OnMapStart()
{
PrecacheSound(SOUND_WINDUP);
PrecacheSound(SOUND_WINDDOWN);
PrecacheSound(SOUND_GUNFIRE);
PrecacheSound(SOUND_GUNSPIN);
}
public Action OnPlayerRunCmd(int iClient, int& iButtons, int& iImpulse, float[3] fVel, float[3] fAng, int& iWeapon)
{
if(!stopsound)
{
return Plugin_Continue;
}
if (IsValidClient(iClient))
{
int weapon = GetPlayerWeaponSlot(iClient, 0);
char classname[64];
GetEntityClassname(weapon, classname, sizeof(classname));
if(IsValidEntity(weapon) && StrEqual(classname, "tf_weapon_minigun", false))
{
int iWeaponState = GetEntProp(weapon, Prop_Send, "m_iWeaponState");
if (iWeaponState == 1 && !Locked1[iClient])
{
EmitSoundToAll(SOUND_WINDUP, iClient); //Problematic part <---------------------------------------------------------
// PrintToChatAll("WeaponState = Windup");
Locked1[iClient] = true;
Locked2[iClient] = false;
Locked3[iClient] = false;
CanWindDown[iClient] = true;
StopSound(iClient, SNDCHAN_AUTO, SOUND_GUNSPIN);
StopSound(iClient, SNDCHAN_AUTO, SOUND_GUNFIRE);
}
else if (iWeaponState == 2 && !Locked2[iClient])
{
EmitSoundToAll(SOUND_GUNFIRE, iClient);
// PrintToChatAll("WeaponState = Firing");
Locked2[iClient] = true;
Locked1[iClient] = true;
Locked3[iClient] = false;
CanWindDown[iClient] = true;
StopSound(iClient, SNDCHAN_AUTO, SOUND_GUNSPIN);
StopSound(iClient, SNDCHAN_AUTO, SOUND_WINDUP);
for(int i=0; i<7; i++)
{
for(int s=1; s<MaxClients; s++)
{
StopSound(iClient, s, "weapons\\minigun_shoot.wav");
}
if(GetEntPropEnt(iClient, Prop_Send, "m_hActiveWeapon")!=0)
{
StopSound(GetEntPropEnt(iClient, Prop_Send, "m_hActiveWeapon"), i, "weapons\\minigun_shoot.wav");
}
}
}
else if (iWeaponState == 3 && !Locked3[iClient])
{
EmitSoundToAll(SOUND_GUNSPIN, iClient);
// PrintToChatAll("WeaponState = Spun Up");
Locked3[iClient] = true;
Locked1[iClient] = true;
Locked2[iClient] = false;
CanWindDown[iClient] = true;
StopSound(iClient, SNDCHAN_AUTO, SOUND_GUNFIRE);
StopSound(iClient, SNDCHAN_AUTO, SOUND_WINDUP);
}
else if (iWeaponState == 0)
{
if (CanWindDown[iClient])
{
// PrintToChatAll("WeaponState = WindDown");
EmitSoundToAll(SOUND_WINDDOWN, iClient);
CanWindDown[iClient] = false;
}
StopSound(iClient, SNDCHAN_AUTO, SOUND_GUNSPIN);
StopSound(iClient, SNDCHAN_AUTO, SOUND_GUNFIRE);
Locked1[iClient] = false;
Locked2[iClient] = false;
Locked3[iClient] = false;
}
}
}
return Plugin_Continue;
}
If anyone has any idea what's wrong with rollingup.wav, then please reply!