Raised This Month: $120 Target: $400
 30% 

[TF2] Sound not working...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Naydef
Senior Member
Join Date: Dec 2015
Location: Doom Town, Nevada
Old 09-16-2018 , 07:30   [TF2] Sound not working...
Reply With Quote #1

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 iClientintiButtonsintiImpulsefloat[3fVelfloat[3fAngintiWeapon
{
    if(!
stopsound)
    {
        return 
Plugin_Continue;
    }
    if (
IsValidClient(iClient)) 
    {    
        
int weapon GetPlayerWeaponSlot(iClient0);
        
char classname[64];
        
GetEntityClassname(weaponclassnamesizeof(classname));
        if(
IsValidEntity(weapon) && StrEqual(classname"tf_weapon_minigun"false))
        {
            
int iWeaponState GetEntProp(weaponProp_Send"m_iWeaponState");
            if (
iWeaponState == && !Locked1[iClient])
            {
                
EmitSoundToAll(SOUND_WINDUPiClient); //Problematic part <---------------------------------------------------------
            //    PrintToChatAll("WeaponState = Windup");
                
                
Locked1[iClient] = true;
                
Locked2[iClient] = false;
                
Locked3[iClient] = false;
                
CanWindDown[iClient] = true;
                
                
StopSound(iClientSNDCHAN_AUTOSOUND_GUNSPIN);
                
StopSound(iClientSNDCHAN_AUTOSOUND_GUNFIRE);
            }
            else if (
iWeaponState == && !Locked2[iClient])
            {
                
EmitSoundToAll(SOUND_GUNFIREiClient);
            
//    PrintToChatAll("WeaponState = Firing");
                
                
Locked2[iClient] = true;
                
Locked1[iClient] = true;
                
Locked3[iClient] = false;
                
CanWindDown[iClient] = true;
                
                
StopSound(iClientSNDCHAN_AUTOSOUND_GUNSPIN);
                
StopSound(iClientSNDCHAN_AUTOSOUND_WINDUP);
                for(
int i=0i<7i++)
                {
                    for(
int s=1s<MaxClientss++)
                    {
                        
StopSound(iClients"weapons\\minigun_shoot.wav");
                    }
                    if(
GetEntPropEnt(iClientProp_Send"m_hActiveWeapon")!=0)
                    {
                        
StopSound(GetEntPropEnt(iClientProp_Send"m_hActiveWeapon"), i"weapons\\minigun_shoot.wav");
                    }
                }
            }
            else if (
iWeaponState == && !Locked3[iClient])
            {
                
EmitSoundToAll(SOUND_GUNSPINiClient);
            
//    PrintToChatAll("WeaponState = Spun Up");
                
                
Locked3[iClient] = true;
                
Locked1[iClient] = true;
                
Locked2[iClient] = false;
                
CanWindDown[iClient] = true;
                
                
StopSound(iClientSNDCHAN_AUTOSOUND_GUNFIRE);
                
StopSound(iClientSNDCHAN_AUTOSOUND_WINDUP);
            }
            else if (
iWeaponState == 0)
            {
                if (
CanWindDown[iClient])
                {
            
//        PrintToChatAll("WeaponState = WindDown");
                    
EmitSoundToAll(SOUND_WINDDOWNiClient);
                    
CanWindDown[iClient] = false;
                }
                
                
StopSound(iClientSNDCHAN_AUTOSOUND_GUNSPIN);
                
StopSound(iClientSNDCHAN_AUTOSOUND_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!
Attached Files
File Type: zip sounds.zip (427.5 KB, 6 views)
__________________
My plugins:
Admin Stealth REDUX(v1.6.1)

Steam:
naydef

Last edited by Naydef; 09-16-2018 at 07:38.
Naydef is offline
Sarge Benny
Junior Member
Join Date: Jan 2016
Old 09-17-2018 , 00:56   Re: [TF2] Sound not working...
Reply With Quote #2

Fixed it for ya, tested working. For the changes you need to do, I couldn't fit them on a screenshot to post here so just go through here, the very bottom is first commit (not modified, aka your source code) second one up is the changes and the very top is a bugfix I had to do to make it play to all clients as intended. Anyway yeah give this a look! https://gist.github.com/Dovahkiin-Wa...0f91/revisions
Sarge Benny is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:08.


Powered by vBulletin®
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Theme made by Freecode