Raised This Month: $51 Target: $400
 12% 

Emit Sound Not Working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
proffs
Senior Member
Join Date: Jul 2013
Old 10-20-2013 , 04:07   Emit Sound Not Working
Reply With Quote #1

The Emit Sound doesn't work.
There is no sound when you hit someone.


return FMRES_IGNORED
}[/PHP]

Last edited by proffs; 10-20-2013 at 05:26.
proffs is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-20-2013 , 04:13   Re: Emit Sound Not Working
Reply With Quote #2

Remove sound/ from paths.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
proffs
Senior Member
Join Date: Jul 2013
Old 10-20-2013 , 04:27   Re: Emit Sound Not Working
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
Remove sound/ from paths.
great works, ONly on slash not the others.

I am using this instead now:
PHP Code:
public EmitSound(idchannelsample[])
{
    if(!
is_user_alive(id)) 
        return 
FMRES_IGNORED
    
    
if ( cs_get_user_team id ) == CS_TEAM_T )
    {    
        new 
temp[2], weapon get_user_weapon(idtemp[0], temp[1])
        if( 
g_iCurrentGame == GAME_BOXING )
        {    
            if(
weapon == CSW_KNIFE)
            {
                if(
equal(sample,"weapons/knife_hit1.wav")) 
                {
                    
emit_sound(idCHAN_WEAPONg_szBoxingSound11.0ATTN_NORM0PITCH_NORM)
                    return 
FMRES_SUPERCEDE
                
}
                else if(
equal(sample,"weapons/knife_hit2.wav")) 
                {
                    
emit_sound(idCHAN_WEAPONg_szBoxingSound21.0ATTN_NORM0PITCH_NORM)
                    return 
FMRES_SUPERCEDE
                
}
                else if(
equal(sample,"weapons/knife_hit3.wav")) 
                {
                    
emit_sound(idCHAN_WEAPONg_szBoxingSound31.0ATTN_NORM0PITCH_NORM)
                    return 
FMRES_SUPERCEDE
                
}
                else if(
equal(sample,"weapons/knife_hit4.wav")) 
                {
                    
emit_sound(idCHAN_WEAPONg_szBoxingSound41.0ATTN_NORM0PITCH_NORM)
                    return 
FMRES_SUPERCEDE
                
}
                else if(
equal(sample,"weapons/knife_hit5.wav")) 
                {
                    
emit_sound(idCHAN_WEAPONg_szBoxingSound51.0ATTN_NORM0PITCH_NORM)
                    return 
FMRES_SUPERCEDE
                
}
            }
        }
    }
    return 
FMRES_IGNORED;

proffs is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-20-2013 , 05:16   Re: Emit Sound Not Working
Reply With Quote #4

PHP Code:
    if(!is_user_alive(id))  
        return 
FMRES_IGNORED 
     
    
if ( cs_get_user_team id ) == CS_TEAM_T 
    {     
        new 
temp[2], weapon get_user_weapon(idtemp[0], temp[1]) 
        if( 
g_iCurrentGame == GAME_BOXING 
        {     
            if(
weapon == CSW_KNIFE
->

PHP Code:
    if( g_iCurrentGame == GAME_BOXING && is_user_alive(id) && cs_get_user_team id ) == CS_TEAM_T && get_user_weapon(id) == CSW_KNIFE )
    { 
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 10-20-2013 at 05:18.
ConnorMcLeod is offline
proffs
Senior Member
Join Date: Jul 2013
Old 10-20-2013 , 05:26   Re: Emit Sound Not Working
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
Remove sound/ from paths.
Quote:
Originally Posted by ConnorMcLeod View Post
PHP Code:
    if(!is_user_alive(id))  
        return 
FMRES_IGNORED 
     
    
if ( cs_get_user_team id ) == CS_TEAM_T 
    {     
        new 
temp[2], weapon get_user_weapon(idtemp[0], temp[1]) 
        if( 
g_iCurrentGame == GAME_BOXING 
        {     
            if(
weapon == CSW_KNIFE
->

PHP Code:
    if( g_iCurrentGame == GAME_BOXING && is_user_alive(id) && cs_get_user_team id ) == CS_TEAM_T && get_user_weapon(id) == CSW_KNIFE )
    { 
Thanks, But some of the sound is still not replaced. Like the knife_stab..
proffs is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-20-2013 , 05:29   Re: Emit Sound Not Working
Reply With Quote #6

Better to use a trie though :

If there is still a problem with some sounds, problem is not with code, problem is with original sound name, or new sound name, or new sound encoding.

PHP Code:

new const g_szBoxingSound1[ ] = "hays/knife_hit1.wav";
new const 
g_szBoxingSound2[ ] = "hays/knife_hit2.wav";
new const 
g_szBoxingSound3[ ] = "hays/knife_hit3.wav";
new const 
g_szBoxingSound4[ ] = "hays/knife_hit4.wav";
new const 
g_szBoxingSound5[ ] = "hays/knife_stab.wav"

new 
Trie:g_tKnifeSoundsReplacement;

new 
g_iMaxPlayers;
#define IsPlayer(%0)    ( 1 <= (%0) <= g_iMaxPlayers )

public plugin_init()
{
    
g_tKnifeSoundsReplacement TrieCreate();
    
TrieSetString(g_tKnifeSoundsReplacement"weapons/knife_hit1.wav"g_szBoxingSound1);
    
TrieSetString(g_tKnifeSoundsReplacement"weapons/knife_hit2.wav"g_szBoxingSound2);
    
TrieSetString(g_tKnifeSoundsReplacement"weapons/knife_hit3.wav"g_szBoxingSound3);
    
TrieSetString(g_tKnifeSoundsReplacement"weapons/knife_hit4.wav"g_szBoxingSound4);
    
TrieSetString(g_tKnifeSoundsReplacement"weapons/knife_stab.wav"g_szBoxingSound5);

    
register_forward(FM_EmitSound"OnEmitSound"false);
}

public 
plugin_precache() 

    
precache_soundg_szBoxingSound1 ); 
    
precache_soundg_szBoxingSound2 ); 
    
precache_soundg_szBoxingSound3 ); 
    
precache_soundg_szBoxingSound4 ); 
    
precache_soundg_szBoxingSound5 ); 
}  

// void        (*pfnEmitSound)                (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch);
public OnEmitSound(idchannel, const sample[], Float:volumeFloat:attenuationfFlagspitch)
{
    static 
szNewSound[32];
    if(    
g_iCurrentGame == GAME_BOXING
    
&&    IsPlayer(id)
    &&    
cs_get_user_team id ) == CS_TEAM_T
    
&&    get_user_weapon(id) == CSW_KNIFE
    
&&    TrieGetString(g_tKnifeSoundsReplacementsampleszNewSoundcharsmax(szNewSound))    )
    {
        
emit_sound(idchannelszNewSoundvolumeattenuationfFlagspitch);
        return 
FMRES_SUPERCEDE;
    }
    return 
FMRES_IGNORED;

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
proffs
Senior Member
Join Date: Jul 2013
Old 10-20-2013 , 05:38   Re: Emit Sound Not Working
Reply With Quote #7

Quote:
Originally Posted by ConnorMcLeod View Post
Better to use a trie though :

If there is still a problem with some sounds, problem is not with code, problem is with original sound name, or new sound name, or new sound encoding.
Works great, thanks!
proffs is offline
Reply



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 06:15.


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