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

Solved [CSGO] Custom Death Sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
srvmil
Senior Member
Join Date: Oct 2010
Old 01-15-2018 , 07:34   [CSGO] Custom Death Sound
Reply With Quote #1

Whenever CT shoots the Terrorist and dies, it should play the dead sound to the victim who died.

However, sound file is only for Terrorist as this is for mod, CT dead sound should remain default. Is there any ways to change the death sound for Terrorist?

I know there is a plugin that exist but it didn't work for CSGO as it won't play the file or something.
https://forums.alliedmods.net/showthread.php?p=2310483

Last edited by srvmil; 01-21-2018 at 00:28.
srvmil is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 01-17-2018 , 18:27   Re: [CSGO] Custom Death Sound
Reply With Quote #2

PHP Code:
#include <sourcemod>
#include <cstrike>
#include <emitsoundany>

public void OnPluginStart()
{
    
HookEvent("player_death"PlayerDeath);
}

public 
OnMapStart()
{
    
AddFileToDownloadsTable("sound/sourcemod/customdeathsound/sound.mp3");
    
PrecacheSoundAny("sourcemod/customdeathsound/sound.mp3");


public 
Action PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
int team GetClientTeam(client);

    if(
team == CS_TEAM_T && IsValidClient(client))
    {
        
EmitSoundToClientAny(client"sourcemod/customdeathsound/sound.mp3");
    }

    return 
Plugin_Continue;
}

public 
bool IsValidClient(int client)
{
    if(
client <= ) return false;
    if(
client MaxClients) return false;
    if(!
IsClientConnected(client)) return false;
    return 
IsClientInGame(client);

__________________
PinHeaDi is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 01-18-2018 , 03:37   Re: [CSGO] Custom Death Sound
Reply With Quote #3

I did this plugin a few days ago for @srvmil

My plugin blocks the default death sound and emit a new one.
Attached Files
File Type: sp Get Plugin or Get Source (deathsound.sp - 427 views - 1,016 Bytes)
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 01-18-2018 at 03:43.
Franc1sco is offline
Send a message via MSN to Franc1sco
Lannister
Veteran Member
Join Date: Apr 2015
Old 01-18-2018 , 11:29   Re: [CSGO] Custom Death Sound
Reply With Quote #4

Age of Empires death sounds incoming, seems like a really good idea, by the way, it is possible to add multiple sounds and play them randomly when a player dies? would be interesting to have that instead of just 1 sound.

Thanks!
Lannister is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 01-18-2018 , 12:25   Re: [CSGO] Custom Death Sound
Reply With Quote #5

Quote:
Originally Posted by Lannister View Post
Age of Empires death sounds incoming, seems like a really good idea, by the way, it is possible to add multiple sounds and play them randomly when a player dies? would be interesting to have that instead of just 1 sound.

Thanks!

PHP Code:
public Action OnNormalSoundPlayed(int clients[64], int &numClientschar sample[PLATFORM_MAX_PATH], int &entityint &channelfloat &volumeint &levelint &pitchint &flags)
{
    if(
entity && entity <= MaxClients)
    {
        if(
StrContains(sample"death") != -&& GetClientTeam(entity) == CS_TEAM_T)
        {
            
// Block current death sound and emit a new one
            
switch(GetRandomInt(15))
            {
                case 
1EmitSoundToAllAny("zr/zombie_die1.mp3");
                case 
2EmitSoundToAllAny("zr/zombie_die2.mp3");
                case 
3EmitSoundToAllAny("zr/zombie_die3.mp3");
                case 
4EmitSoundToAllAny("zr/zombie_die4.mp3");
                case 
5EmitSoundToAllAny("zr/zombie_die5.mp3");
            }
            return 
Plugin_Handled;
        }
    }
    return 
Plugin_Continue;

Of course you must precache all souns(PrecacheSoundAny) and add them to the download table(AddFileToDownloadsTable).
__________________

Last edited by PinHeaDi; 01-18-2018 at 12:27.
PinHeaDi 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 05:25.


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