Raised This Month: $ Target: $400
 0% 

Play sound only for killer & victim


Post New Thread Reply   
 
Thread Tools Display Modes
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
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 04-25-2012 , 13:13   Re: Play sound only for killer & victim
Reply With Quote #2

Replace 0 with killer or victim. Index 0 means it will be heard by all players.
Emit_sound is used to play a sound around an entity (specific radius), so you don't need it here.
__________________
<VeCo> is offline
Old 04-25-2012, 13:40
Napoleon_be
This message has been deleted by Exolent[jNr]. Reason: This is not a fight thread.
Old 04-25-2012, 15:37
BeeFighter
This message has been deleted by Exolent[jNr]. Reason: This is not a fight thread.
Old 04-25-2012, 15:41
Napoleon_be
This message has been deleted by Exolent[jNr]. Reason: This is not a fight thread.
Old 04-26-2012, 12:12
simple_user
This message has been deleted by Exolent[jNr]. Reason: This is not a fight thread.
Old 04-26-2012, 12:28
BeeFighter
This message has been deleted by Exolent[jNr]. Reason: This is not a fight thread.
Old 04-26-2012, 12:38
Napoleon_be
This message has been deleted by Exolent[jNr]. Reason: This is not a fight thread.
Old 04-26-2012, 13:01
BeeFighter
This message has been deleted by Exolent[jNr]. Reason: This is not a fight thread.
Old 04-26-2012, 13:28
Napoleon_be
This message has been deleted by Exolent[jNr]. Reason: This is not a fight thread.
Old 04-26-2012, 14:01
BeeFighter
This message has been deleted by Exolent[jNr]. Reason: This is not a fight thread.
Old 04-26-2012, 15:18
.Dare Devil.
This message has been deleted by Exolent[jNr]. Reason: This is not a fight thread.
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 07:48.


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