View Single Post
Drimacus
Member
Join Date: Jun 2011
Old 02-19-2024 , 02:15   Re: Play my sound of death
Reply With Quote #8

Solved.
PHP Code:
public OnPluginStart()
{
    
AddNormalSoundHook(DeathSound);
}

public 
Action:DeathSound(clients[64], &numClientsString:sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags)
{
    if (
StrContains(sample"kevlar"false) != -1)
    {
        
FormatEx(samplesizeof(sample), "hitkill/hit%d.wav"GetRandomInt(1GetConVarInt(cvarHitSoundsCount)));
        return 
Plugin_Changed;
    }
    if (
StrContains(sample"death"false) != -1)
    {
        
FormatEx(samplesizeof(sample), "hitkill/death%d.wav"GetRandomInt(1GetConVarInt(cvarDeathSoundsCount)));
        return 
Plugin_Changed;
    }
    if (
StrContains(sample"headshot"false) != -1)
    {
        
FormatEx(samplesizeof(sample), "hitkill/headshot%d.wav"GetRandomInt(1GetConVarInt(cvarHeadshotSoundsCount)));
        return 
Plugin_Changed;
    }

    return 
Plugin_Continue;

Drimacus is offline