Raised This Month: $ Target: $400
 0% 

hear death sounds and other thing


Post New Thread Reply   
 
Thread Tools Display Modes
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 06-24-2007 , 09:43   Re: hear death sounds and other thing
Reply With Quote #11

Quote:
Originally Posted by regalis View Post
Either you would like to emit a sound or not..
If you want to you have to create a entity...
I have coded something for you, you have to adjust the soundfile to your favour:
Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "DeathSounds"
#define VERSION "0.1"
#define AUTHOR "regalis"


public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);
    register_cvar(PLUGIN, VERSION, FCVAR_SERVER);
    
    // Events
    register_event("DeathMsg", "hook_death", "a");
}


public plugin_precache()
{
    precache_sound("misc/affn.wav");
}


public hook_death()
{
    //new Killer = read_data(1); //get the first message parameter
    new Victim = read_data(2); //get the second message parameter
    //new headshot = read_data(3); //was this a headshot?
    //new weapon[32];
    //read_data(4, weapon, 31);  //get the weapon name
    
    new origin[3];
    pev(Victim, pev_origin, origin);
    
    new entity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
    engfunc(EngFunc_SetOrigin, entity, origin);
    set_pev(entity, pev_classname, "emitter");
    
    emit_sound(entity, CHAN_VOICE, "misc/affn.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
    
    set_task(5.0, "kill_entity", entity+1337);
}


public kill_entity(ent)
{
    new id = ent-1337;
    
    if(!pev_valid(id)) return;
    
    engfunc(EngFunc_RemoveEntity, id);
}
greetz regalis
__________________
regalis is offline
kmal2t
BANNED
Join Date: Apr 2006
Old 06-24-2007 , 15:01   Re: hear death sounds and other thing
Reply With Quote #12

I have actually done this before and I've found the best way is through deathmsg and you can emit a sound from victim (i use a 0.1 set_task) to emit their death scream or whatever you want to use.
kmal2t is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-24-2007 , 17:09   Re: hear death sounds and other thing
Reply With Quote #13

Can't you use the forward emitsound (or fakemeta way) to hook death sounds and replace them ?
ConnorMcLeod 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 20:45.


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