AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Death Sounds HELP!!! ****** (https://forums.alliedmods.net/showthread.php?t=60887)

purple nurple 09-15-2007 15:57

Death Sounds HELP!!! ******
 
I need help with this it doesn't work right but i want it to make that sound when a person dies can anyone help?

PHP Code:

#include <amxmodx>


#define PLUGIN "Death sounds"
#define VERSION "1.0"
#define AUTHOR "purple nurple"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("DeathMsg","event_death","a"
}

public 
event_death(id)
    {
    
emit_sound(idCHAN_VOICE,"zombie/zombie_die3.wav"1.0ATTN_NORM0PITCH_NORM)
}
public 
plugin_precache()
{
    
precache_sound("zombie/zombie_die3.wav")


Can anyone help?

ConnorMcLeod 09-15-2007 17:57

Re: Death Sounds HELP!!! ******
 
You have to precache the sound.

Also you can try to register forward emitsound, filter by sounds and when pl_die sound is played, check if player is zombie, then block the sound and play yours.

purple nurple 09-15-2007 18:02

Re: Death Sounds HELP!!! ******
 
Quote:

Also you can try to register forward emitsound, filter by sounds and when pl_die sound is played, check if player is zombie, then block the sound and play yours.
that is a example i have it precached but when a person dies nothing happens i just here the normal die sound

could you give me a example of what your talking about?

ConnorMcLeod 09-15-2007 19:59

Re: Death Sounds HELP!!! ******
 
Something like that :

PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init() {
    
register_plugin("","","")
    
register_forward(FM_EmitSound"fwEmitSound")
}

public 
fwEmitSound(entchannel, const sample[], Float:volumeFloatattenuationflagspitch)
    
// Check here if the sound is some die sounds
    //if not then :
    
return FMRES_IGNORED

    
//if the sound is die
    //then check if the player is a zombie
    //if not :
    
return FMRES_IGNORED
    
    
//else :
    
engfunc(EngFunc_EmitSound /*****/    //(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch);
    
return FMRES_HANDLED



hlstriker 09-15-2007 22:20

Re: Death Sounds HELP!!! ******
 
Here is a more further detailed example based from connorrs example:
PHP Code:

public fwEmitSound(idchannel, const sound[], Float:volumeFloat:attenuationflagspitch)
{
    
// Check to see if user is connected and a zombie (using isZombie for example)
    
if(!is_user_connected(id) || !isZombie[id])
        return 
FMRES_IGNORED;
    
    if(
containi(sound"die") != -|| containi(sound"death") != -1)
    {
        
// Here it will play your sound and block the old death sound
        
engfunc(EngFunc_EmitSoundidchannel"zombie/zombie_die3.wav"1.0attenuationflagspitch);
        
        
// Below I made it so it would play a random death sound when they died, just for an example
        /*
        new randNum = random_num(1, 4);
        switch(randNum)
        {
            case 1: engfunc(EngFunc_EmitSound, id, channel, ZOMBIE_DEATH_1, 0.7, attenuation, flags, pitch);
            case 2: engfunc(EngFunc_EmitSound, id, channel, ZOMBIE_DEATH_2, 0.7, attenuation, flags, pitch);
            case 3: engfunc(EngFunc_EmitSound, id, channel, ZOMBIE_DEATH_3, 0.7, attenuation, flags, pitch);
            case 4: engfunc(EngFunc_EmitSound, id, channel, ZOMBIE_DEATH_4, 0.7, attenuation, flags, pitch);
        }
        */
        
return FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;



purple nurple 09-17-2007 22:35

Re: Death Sounds HELP!!! ******
 
I just found out by testing the the player/die.wav or player/death.wav aren't emitted sounds.


All times are GMT -4. The time now is 16:14.

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