AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   hear death sounds and other thing (https://forums.alliedmods.net/showthread.php?t=55078)

flyeni6 05-12-2007 19:40

hear death sounds and other thing
 
1. ok i have these custom death sounds.
when someone gets killed, i want the other people that are still alive near the person when he/she got killed hear the death sound.

how do i do it because im not that familliar with emit sound


2. i have this code frm VEN's sticky nades. Can some one transfer this into fakemeta?
Code:
#include <amxmodx> #include <amxmisc> #include <engine> #define PLUGIN "New Plugin" #define VERSION "1.0" #define AUTHOR "Author" public plugin_init() {  register_plugin(PLUGIN, VERSION, AUTHOR)    register_touch("grenade", "player", "touch_nade") } public touch_nade(nade, id) {  entity_set_edict(nade, EV_ENT_aiment, id)  entity_set_int(nade, EV_INT_movetype, MOVETYPE_FOLLOW)  entity_set_int(nade, EV_INT_sequence, 0)  return PLUGIN_CONTINUE }

flyeni6 05-13-2007 11:36

Re: hear death sounds and other thing
 
accually never mind about the second request.

i just need help on the first

Alka 05-13-2007 12:54

Re: hear death sounds and other thing
 
hmmm...i can make to play the sound only to alive players...but not near!

flyeni6 05-13-2007 12:56

Re: hear death sounds and other thing
 
yea i know how to do that lol.

im just not familiar with emit_sound

regalis 05-13-2007 17:46

Re: hear death sounds and other thing
 
Check this out...maybe it works:
Code:

emit_sound(PlayerID, CHAN_WEAPON, "weapons/grenade_hit3.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
I use this to emit the sound when a nade bounces of the ground...maybe it is possible to let a player emit a sound...
Or maybe create an invisible entity at the position of the dead player. And let this emit the sound!?

only my 2 cent ;)

greetz regalis

flyeni6 05-13-2007 23:40

Re: hear death sounds and other thing
 
no what im doing wouldn't be right if an invisble entity was created

djmd378 05-14-2007 02:02

Re: hear death sounds and other thing
 
Try using this
Code:

  emit_sound(id, CHAN_VOICE, "soundpath/soundtoplay.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

regalis 05-14-2007 05:09

Re: hear death sounds and other thing
 
Quote:

Originally Posted by flyeni6 (Post 476390)
no what im doing wouldn't be right if an invisble entity was created

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

flyeni6 05-16-2007 21:44

Re: hear death sounds and other thing
 
k ill try it out thx

mut2nt 06-24-2007 05:55

Re: hear death sounds and other thing
 
hy 2 all..
I want a sound to be played on the dead guy...after he got killed...


All times are GMT -4. The time now is 10:38.

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