Raised This Month: $ Target: $400
 0% 

hear death sounds and other thing


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-14-2007 , 05:09   Re: hear death sounds and other thing
Reply With Quote #7

Quote:
Originally Posted by flyeni6 View Post
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
__________________
regalis is offline
 



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 10:38.


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