Raised This Month: $ Target: $400
 0% 

HeadShot Sounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mifuntm
Senior Member
Join Date: Feb 2008
Location: in space...
Old 05-09-2010 , 10:13   HeadShot Sounds
Reply With Quote #1

Hi!
I have plugin for random headshot sounds, but plugin play this sounds for every player connected to server. I'ts possible to change plugin for playback sounds only for killer and victim?

Thanks! and sorry about my english.
Attached Files
File Type: sma Get Plugin or Get Source (hssounds.sma - 460 views - 1.1 KB)
__________________
Only God can judge me...
Mifuntm is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 05-09-2010 , 10:51   Re: HeadShot Sounds
Reply With Quote #2

Sorry, i forgot what read_data(?) is victim but killer is 1...
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN    "HS Sounds by Mroz!k"
#define AUTHOR    "Mroz!k"
#define VERSION    "1.0"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("DeathMsg","hs","a","3=1")
}

public 
hs(id)
{

    new 
killer read_data(1)

    new 
rand random_num(05)
    switch(
rand) {
        case 
0: {
            
client_cmd(killer"stopsound")
            
client_cmd(killer"spk cyr4x/bezdech")
        }
        case 
1: {
            
client_cmd(killer"stopsound")
            
client_cmd(killer"spk cyr4x/cyr4x_001")
        }
        case 
2: {
            
client_cmd(killer"stopsound")
            
client_cmd(killer"spk cyr4x/cyr4x_006")
        }
        case 
3: {
            
client_cmd(killer"stopsound")
            
client_cmd(killer"spk cyr4x/mk")
        }
        case 
4: {
            
client_cmd(killer"stopsound")
            
client_cmd(killer"spk cyr4x/zobacz")
        }

    }
}

public 
plugin_precache()
{
    
precache_sound("cyr4x/bezdech.wav")
    
precache_sound("cyr4x/cyr4x_001.wav")
    
precache_sound("cyr4x/cyr4x_006.wav")
    
precache_sound("cyr4x/mk.wav")
    
precache_sound("cyr4x/zobacz.wav")

now it will only play for killer
reinert is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 05-09-2010 , 11:19   Re: HeadShot Sounds
Reply With Quote #3

He wants it for victim too.
__________________
hleV is offline
master4life
Senior Member
Join Date: Mar 2006
Location: Germany
Old 05-09-2010 , 11:46   Re: HeadShot Sounds
Reply With Quote #4

http://wiki.amxmodx.org/Half-Life_1_...vents#DeathMsg

read_data( 1 ) is Killer and read_data( 2 ) is Victim

but if you want try this,

PHP Code:
#include < amxmodx >

new const g_szSounds[ ][ ] = {
    
"cyr4x/bezdech.wav",
    
"cyr4x/cyr4x_001.wav",
    
"cyr4x/cyr4x_006.wav",
    
"cyr4x/mk.wav",
    
"cyr4x/zobacz.wav"
}

public 
plugin_init()
    
register_event"DeathMsg""EventDeathMsg""a""3=1" );

public 
plugin_precache( )
    for( new 
0sizeof g_szSoundsi++ )    
        
precache_soundg_szSounds] );

public 
EventDeathMsg( ) {
    new 
iKiller read_data), iVictim read_data);

    
client_cmdiKiller"stopsound" ); client_cmdiVictim"stopsound" );
    
client_cmdiKiller"spk %s"g_szSoundsrandomsizeof g_szSounds ) ] );
    
client_cmdiVictim"spk %s"g_szSoundsrandomsizeof g_szSounds ) ] );

__________________


[img]http://img714.**************/img714/8612/33726.png[/img]

Last edited by master4life; 05-09-2010 at 13:18.
master4life is offline
Send a message via ICQ to master4life Send a message via MSN to master4life Send a message via Skype™ to master4life
Mifuntm
Senior Member
Join Date: Feb 2008
Location: in space...
Old 05-09-2010 , 11:55   Re: HeadShot Sounds
Reply With Quote #5

Quote:
Originally Posted by master4life View Post
http://wiki.amxmodx.org/Half-Life_1_...vents#DeathMsg

read_data( 1 ) is Killer and read_data( 2 ) is Victim

but if you want try this,

PHP Code:
#include < amxmodx >

new const g_szSounds[ ][ ] = {
    
"cyr4x/bezdech.wav",
    
"cyr4x/cyr4x_001.wav",
    
"cyr4x/cyr4x_006.wav",
    
"cyr4x/mk.wav",
    
"cyr4x/zobacz.wav"
}

public 
plugin_init()
    
register_event"DeathMsg""EventDeathMsg""a""3=1" );

public 
plugin_precache( )
    for( new 
0sizeof g_szSoundsi++ )    
        
precache_soundg_szSounds] );

public 
EventDeathMsg( ) {
    new 
iKiller read_data), iVictim read_data);

    
client_cmdiKiller"stopsound" ); client_cmdiVictim"stopsound" );
    
client_cmdiKiller"spk %s"g_szSoundrandomsizeof g_szSound ) ] );
    
client_cmdiVictim"spk %s"g_szSoundrandomsizeof g_szSound ) ] );




Code:
Your plugin failed to compile! Read the errors below:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/groups/amxmodx/tmp3/textuDThRy.sma(22) : error 017: undefined symbol "g_szSound"
/groups/amxmodx/tmp3/textuDThRy.sma(22) : error 072: "sizeof" operator is invalid on "function" symbols
/groups/amxmodx/tmp3/textuDThRy.sma(22) : error 029: invalid expression, assumed zero
/groups/amxmodx/tmp3/textuDThRy.sma(22) : fatal error 107: too many error messages on one line

Compilation aborted.
4 Errors.
__________________
Only God can judge me...
Mifuntm is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 05-09-2010 , 13:48   Re: HeadShot Sounds
Reply With Quote #6

fixed a lil.
Code:
#include < amxmodx > new const g_szSounds[ ][ ] = {     "cyr4x/bezdech.wav",     "cyr4x/cyr4x_001.wav",     "cyr4x/cyr4x_006.wav",     "cyr4x/mk.wav",     "cyr4x/zobacz.wav" } public plugin_init()     register_event( "DeathMsg", "EventDeathMsg", "a", "3=1" ); public plugin_precache( )     for( new i = 0; i < sizeof g_szSounds; i++ )            precache_sound( g_szSounds[ i ] ); public EventDeathMsg( ) {     new iKiller = read_data( 1 ), iVictim = read_data( 2 ); //  client_cmd( iKiller, "stopsound" ); // not needed //  client_cmd( iVictim, "stopsound" );         new iSound = random_num( 0, sizeof g_szSounds );         client_cmd( iKiller, "spk %s", g_szSounds[ iSound ] );     client_cmd( iVictim, "spk %s", g_szSounds[ iSound ] ); }
__________________
xPaw is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 05-09-2010 , 13:35   Re: HeadShot Sounds
Reply With Quote #7

g_szSound


to


g_szSounds
reinert is offline
Mifuntm
Senior Member
Join Date: Feb 2008
Location: in space...
Old 05-09-2010 , 15:30   Re: HeadShot Sounds
Reply With Quote #8

Code:
#include < amxmodx >

new const g_szSounds[ ][ ] = {
    "cyr4x/bezdech.wav",
    "cyr4x/cyr4x_001.wav",
    "cyr4x/cyr4x_006.wav",
    "cyr4x/mk.wav",
    "cyr4x/zobacz.wav"
}

public plugin_init()
    register_event( "DeathMsg", "EventDeathMsg", "a", "3=1" );

public plugin_precache( )
    for( new i = 0; i < sizeof g_szSounds; i++ )    
        precache_sound( g_szSounds[ i ] );

public EventDeathMsg( ) {
    new iKiller = read_data( 1 ), iVictim = read_data( 2 );

//  client_cmd( iKiller, "stopsound" ); // not needed
//  client_cmd( iVictim, "stopsound" );
    
    new iSound = random_num( 0, sizeof g_szSounds );
    
    client_cmd( iKiller, "spk %s", g_szSounds[ iSound ] );
    client_cmd( iVictim, "spk %s", g_szSounds[ iSound ] );
}




work nice

Thanks!
__________________
Only God can judge me...
Mifuntm 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 03:37.


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