Raised This Month: $ Target: $400
 0% 

Weapon shoot sound problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 11-30-2014 , 12:53   Weapon shoot sound problem
Reply With Quote #1

What I need: only player who shoots from certain guns hear the sound of a gunshot.

PHP Code:
public fw_TraceAttack(iEntiAttackerFloat:flDamageFloat:fDir[3], ptriDamageTypeFloat:fVec1[3], Float:fVec2[3])
{
    if(!
is_user_alive(iAttacker))
        return

    new 
g_currentweapon get_user_weapon(iAttacker)

    if(
g_currentweapon != CSW_AUG
        return
    
    if(!
g_has_ethereal[iAttacker]) 
        return

    static 
Float:flEnd[3]
    
get_tr2(ptrTR_vecEndPosflEnd)
    
    if(!
is_user_alive(iEnt))
    {
        if(
eth_mode[iAttacker]==1)
        {
            
Make_BulletHole(iAttackerflEnd,flDamage)
            
Make_BulletSmoke(iAttackerptr)
            
emit_sound(iAttackerCHAN_WEAPONLaser_Sounds[0], VOL_NORMATTN_NORM0PITCH_NORM)
            
LaserBeam(iAttackerflEnd,12,l_ethereal_l_r,l_ethereal_l_g,l_ethereal_l_b,1,1)
        }
        else
        {
            
#if defined electro_fire_hole
                
Make_BulletHole(iAttackerflEnd,flDamage)
            
#endif
            
            #if defined electro_fire_smoke
                
Make_BulletSmoke(iAttackerptr)
            
#endif
            
LaserBeam(iAttacker,flEnd12,e_ethereal_l_r,e_ethereal_l_g,e_ethereal_l_b,e_ethereal_ls_min,e_ethereal_ls_max)
            
emit_sound(iAttackerCHAN_WEAPONElectro_Sounds[0], VOL_NORMATTN_NORM0PITCH_NORM)
        }
    }

I tried something like:

PHP Code:
emit_sound(iAttackerCHAN_WEAPONLaser_Sounds[0], VOL_NORMATTN_NORM0PITCH_NORM

PHP Code:
client_cmd(iAttacker"spk %s"Laser_Sounds[0]) 
I'm interested in is this the correct way to do something like this?

Last edited by Krtola; 11-30-2014 at 13:07.
Krtola is offline
Send a message via Skype™ to Krtola
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 11-30-2014 , 13:30   Re: Weapon shoot sound problem
Reply With Quote #2

Yes it's is, as client_cmd only executes the command to a specific player, which in this case is playing the shooting sound.
Btw, for such questions you should really test it yourself instead of making thread.
RateX is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 11-30-2014 , 13:34   Re: Weapon shoot sound problem
Reply With Quote #3

Quote:
Originally Posted by RateX View Post
Yes it's is, as client_cmd only executes the command to a specific player, which in this case is playing the shooting sound.
Btw, for such questions you should really test it yourself instead of making thread.
I alredy test,and work.
I was only interested in the opinion of experienced people from this forum:is this the correct way.
Krtola is offline
Send a message via Skype™ to Krtola
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 11-30-2014 , 16:12   Re: Weapon shoot sound problem
Reply With Quote #4

You can hook FM_Playback event, and modify first argument (event flags), by doing
Code:
eventFlags |= FEV_HOSTONLY;
and this will send all events to the shooter. But you need to filter events, otherwise you'll block this way smoke grenade explosion effec for exmaple.
__________________


Last edited by NiHiLaNTh; 11-30-2014 at 16:12.
NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 11-30-2014 , 20:54   Re: Weapon shoot sound problem
Reply With Quote #5

Quote:
Originally Posted by NiHiLaNTh View Post
You can hook FM_Playback event, and modify first argument (event flags), by doing
Code:
eventFlags |= FEV_HOSTONLY;
and this will send all events to the shooter. But you need to filter events, otherwise you'll block this way smoke grenade explosion effec for exmaple.
I do not use smokegrenade.
Anyway thank you,I'll try this and see if I can make in that way.
Krtola is offline
Send a message via Skype™ to Krtola
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 15:28.


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