Raised This Month: $ Target: $400
 0% 

Play sound only for killer & victim


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
simple_user
Member
Join Date: Apr 2012
Location: Latvia, the cube
Old 04-25-2012 , 12:50   Play sound only for killer & victim
Reply With Quote #1

So I want to play random sound on knife kill, but only killer and victim should hear it. I don't know how to point out that rule... emit_sound(..?..., CHAN_AUTO, soundlist[random(sizeof soundlist)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM);

Here's the sketch:

Code:
new soundlist[][] =
{
    "custom_sounds/knife1",
    "custom_sounds/knife2",
    "custom_sounds/knife3",
    "custom_sounds/knife4",
    "custom_sounds/knife5",

};

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)

}

public client_death(killer,victim,weapon)
{
    if(!killer || !victim)
        return;
    
    if(weapon == CSW_KNIFE )
    {
        client_cmd(killer ,"spk %s",soundlist[random(sizeof soundlist)]);
    }
    
        
}    

public plugin_precache()
{
    precache_sound("custom_sounds/knife1.wav");
    precache_sound("custom_sounds/knife2.wav");
    precache_sound("custom_sounds/knife3.wav");
    precache_sound("custom_sounds/knife4.wav");
    precache_sound("custom_sounds/knife5.wav");

}
thanks

Last edited by simple_user; 04-25-2012 at 13:33.
simple_user is offline
Send a message via Skype™ to simple_user
 



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 07:48.


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