 |
|
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
|

06-24-2007
, 09:43
Re: hear death sounds and other thing
|
#11
|
Quote:
Originally Posted by regalis
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
|
__________________
|
|
|
|