Raised This Month: $ Target: $400
 0% 

Solved Emit Sound Problem. Fire sound is overlapping my sounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 07-01-2018 , 17:15   Re: Emit Sound Problem. Fire sound is overlapping my sounds
Reply With Quote #1

Check if any of your weapon you are using have CHAN_AUTO or CHAN_VOICE for shooting sound
__________________
My plugin:
Celena Luna is offline
esenrik
Senior Member
Join Date: Jul 2010
Old 07-01-2018 , 17:23   Re: Emit Sound Problem. Fire sound is overlapping my sounds
Reply With Quote #2

Quote:
Originally Posted by Celena Luna View Post
Check if any of your weapon you are using have CHAN_AUTO or CHAN_VOICE for shooting sound
I never modified weapon sounds, so they are using the default shooting channel...
esenrik is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 07-01-2018 , 17:30   Re: Emit Sound Problem. Fire sound is overlapping my sounds
Reply With Quote #3

Quote:
Originally Posted by esenrik View Post
I never modified weapon sounds, so they are using the default shooting channel...
If possible, show full code is recommended (or that is all you wrote?)
__________________
My plugin:

Last edited by Celena Luna; 07-01-2018 at 17:30.
Celena Luna is offline
esenrik
Senior Member
Join Date: Jul 2010
Old 07-01-2018 , 17:34   Re: Emit Sound Problem. Fire sound is overlapping my sounds
Reply With Quote #4

Quote:
Originally Posted by Celena Luna View Post
If possible, show full code is recommended (or that is all you wrote?)
This is the actual code..

PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < zombieplague >

const m_pPlayer          41;
const 
m_fInReload        54;
const 
m_fInSpecialReload 55;
const 
m_flTimeWeaponIdle 48;

// SONIDOS DE RECARGA

new const reload1[] = "zombie_plague/zs_recargando_1.wav"
new const reload2[] = "zombie_plague/zs_recargando_2.wav"
new const reload3[] = "zombie_plague/zs_recargando_3.wav"
new const reload4[] = "zombie_plague/zs_recargando_4.wav"


public plugin_init( )
{
    
// 2 = CSW_SHIELD = UNDEFINED | PUT SHOTGUNS HERE TO SKIP IN LOOP AND REGISTER MANUALLY
    
new const NO_RELOAD = ( << ) | ( << CSW_KNIFE ) | ( << CSW_C4 ) | ( << CSW_M3 ) |
        ( 
<< CSW_XM1014 ) | ( << CSW_HEGRENADE ) | ( << CSW_FLASHBANG ) | ( << CSW_SMOKEGRENADE );
    
    new 
szWeaponName20 ];
    
    for( new 
CSW_P228<= CSW_P90i++ )
    {
        
// If its no-reload weapon or shotgun skip it
        
if( NO_RELOAD & ( << ) )
        {
            continue;
        }
        
        
// Get weapon name
        
get_weaponnameiszWeaponName19 );
        
        
// Register forward
        
RegisterHamHam_Weapon_ReloadszWeaponName"FwdHamWeaponReload");
    }
    
    
// Register shotguns, we need different function for additional checks
    
RegisterHamHam_Weapon_Reload"weapon_m3",     "FwdHamShotgunReload");
    
RegisterHamHam_Weapon_Reload"weapon_xm1014""FwdHamShotgunReload");
}

public 
plugin_precache()
{
    
precache_sound(reload1)
    
precache_sound(reload2)
    
precache_sound(reload3)
    
precache_sound(reload4)

}

public 
FwdHamWeaponReload( const iWeapon )
{
    
// m_fInReload is set to TRUE in DefaultReload( )
    // We are only checking if this offset is set to true because
    // Ham_Weapon_Reload is being called as long as player holds the reload key
    // But its only called once if weapon is being reloaded, and doesnt call more while its reloading
    
if( get_pdata_intiWeaponm_fInReload) )
    {
        static 
id
        id 
pev(iWeaponpev_owner)
        
        if(!
is_user_alive(id) || !is_user_connected(id) || zp_get_user_zombie(id))
            return 
HAM_IGNORED
        
        
        
// Weapon has started reload
        //console_print(0, "COMIENZA A RECARGAR EL ID: %i", id)
        
new random random_num(14)
        if (
random == 1) {
        
emit_sound(idCHAN_BODY reload11.0ATTN_NORM0PITCH_NORM );
        
//emit_sound(id, CHAN_VOICE, reload1, 1.0, ATTN_NORM, 0, PITCH_NORM)
        
} else if (random == 2) {
        
emit_sound(idCHAN_BODY reload21.0ATTN_NORM0PITCH_NORM );
        
//emit_sound(id, CHAN_VOICE, reload2, 1.0, ATTN_NORM, 0, PITCH_NORM)
        
} else if (random == 3) {
        
emit_sound(idCHAN_BODY reload31.0ATTN_NORM0PITCH_NORM );
        
//emit_sound(id, CHAN_VOICE, reload3, 1.0, ATTN_NORM, 0, PITCH_NORM)
        
} else if (random == 4) {
        
emit_sound(idCHAN_BODY reload41.0ATTN_NORM0PITCH_NORM );
        
//emit_sound(id, CHAN_VOICE, reload4, 1.0, ATTN_NORM, 0, PITCH_NORM)
        
}
        
        
// To check if its reload by player or auto (0 ammo) you can do this:
        //  Check !( get_user_button( id ) & IN_BUTTON ) 
        //  Or check if clip ammo equals to 0
    
}
}
public 
FwdHamShotgunReload( const iWeapon )
{
    
// in Reload( ) there is switch of this offset
    // On case 0 it is being set to 1 and some weapon idle/nextattacks are being set to 0.55
    // case 1: bullet input animation
    // case 2: adding bullet to clip itself
    // this case 1-2-1 is being looped while the shotgun is reloading
    
if( get_pdata_intiWeaponm_fInSpecialReload) != )
    {
        return;
    }
    
    
// If you will remove the check below, you will be able to hook when engine
    // sets animation (M3_INSERT) bullet
    
    // The first set of m_fInSpecialReload to 1. m_flTimeWeaponIdle remains 0.55 set from Reload( )
    
new Float:flTimeWeaponIdle get_pdata_floatiWeaponm_flTimeWeaponIdle);
    
    if( 
flTimeWeaponIdle != 0.55 )
    {
        return;
    }
    
    
// Shotgun has started reload

In this code sound is in CHAN_BODY, but I tested all channels.

Last edited by esenrik; 07-01-2018 at 17:40.
esenrik is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 07-01-2018 , 18:06   Re: Emit Sound Problem. Fire sound is overlapping my sounds
Reply With Quote #5

Spoiler


Totally fine. Here is the video.


Change:
+ From If...Else to Switch...Case (this is not effect the results)
+ Reload Audio (since I don't have yours)
+ Change back to CHAN_VOICE
+ Adding Random Number check print chat
+ random => r_num

=> It is not because of the plugin at all
__________________
My plugin:

Last edited by Celena Luna; 07-01-2018 at 18:08.
Celena Luna is offline
esenrik
Senior Member
Join Date: Jul 2010
Old 07-01-2018 , 18:11   Re: Emit Sound Problem. Fire sound is overlapping my sounds
Reply With Quote #6

Quote:
Originally Posted by Celena Luna View Post
Spoiler


Totally fine. Here is the video.


Change:
+ From If...Else to Switch...Case (this is not effect the results)
+ Reload Audio (since I don't have yours)
+ Change back to CHAN_VOICE
+ Adding Random Number check print chat
+ random => r_num

=> It is not because of the plugin at all
Thanks for all your effort, i sent you a pm !!
esenrik 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 12:27.


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