AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Headshot Sound ! (https://forums.alliedmods.net/showthread.php?t=215694)

Darksmith 05-11-2013 07:43

Headshot Sound !
 
Hello Guys
I Tried To Use a Sound for Headshot (Bom Headshot) But it Dosn't work :(

Quote:

#include <amxmodx>


new const BoomHeadShot[] = "jbextreme/HS-darksmith.wav";

enum _:DeathMsg
{
Killer = 1,
Victim,
IsHeadShot,
WeaponName
}

public plugin_precache()
{

precache_sound( BoomHeadShot );
}

public plugin_init()
{

register_event( "DeathMsg" , "EvDeathMsg_Hs" , "a" , "3=1" );
}

public EvDeathMsg_Hs()
{

client_cmd( read_data( Killer ) , "spk %s" , BoomHeadShot );
set_hudmessage (255, 000, 000, -1.0, 0.61, 2, 0.02, 6.0, 0.01, 0.1, -1);
show_hudmessage(Victim, "HEADSHOT!");
set_hudmessage (255, 000, 000, -1.0, 0.61, 2, 0.02, 6.0, 0.01, 0.1, -1);
show_hudmessage(Killer, "HEADSHOT!");
}
Help Me pleise !

hornet 05-11-2013 08:20

Re: Headshot Sound !
 
Remove the last parameter in register_event() and read headshot inside the hook.

Napoleon_be 05-11-2013 08:28

Re: Headshot Sound !
 
PHP Code:

#include <amxmodx>

#define VERSION "1.0" 

new const g_szSound[][] = {
    
"headshot/headshot1",
    
"headshot/headshot2",
    
"headshot/headshot3"
}

public 
plugin_precache() {
    for(new 
0sizeof(g_szSound); i++) {
        
precache_sound(g_szSound[i]);
    }
}


public 
plugin_init() { 
    
register_plugin("Headshot Sound"VERSION"NapoleoN#"); 
    
    
register_event("DeathMsg""eDeath""a""1>0""2>0""3=1");



public 
eDeath() {
    
client_cmd0"spk ^"%s^""g_szSoundrandom_num0sizeof g_szSound ) ] );


Old plugin from me... Got some help from xPaw with this so we were discussing what's the best way to make a headshot sound plugin, and it looks like this way is the best way :)

hornet 05-11-2013 08:32

Re: Headshot Sound !
 
Quote:

Originally Posted by Napoleon_be (Post 1949861)
Old plugin from me... Got some help from xPaw with this so we were discussing what's the best way to make a headshot sound plugin, and it looks like this way is the best way :)

By reading what he has posted it's clear that he only wants the sound played to the killer and victim.

Bos93 05-11-2013 08:42

Re: Headshot Sound !
 
Quote:

Old plugin from me... Got some help from xPaw with this so we were discussing what's the best way to make a headshot sound plugin, and it looks like this way is the best way :)
I think it would be more effective to change the sound in Emitsound

New sound + block default

hornet 05-11-2013 09:11

Re: Headshot Sound !
 
Quote:

Originally Posted by Bos93 (Post 1949871)
I think it would be more effective to change the sound in Emitsound

New sound + block default

Huh? And what would be the default headshot sound?

Bos93 05-11-2013 09:17

Re: Headshot Sound !
 
Quote:

Originally Posted by hornet (Post 1949886)
Huh? And what would be the default headshot sound?


Your new sound O_O


PHP Code:

public eDeath() {
    
client_cmd0"spk ^"%s^""g_szSoundrandom_num0sizeof g_szSound ) ] ); 


So it will play two sound, new and default

hornet 05-11-2013 09:22

Re: Headshot Sound !
 
We're talking about playing a sound, not blocking one, and not emitting one.


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

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