Raised This Month: $32 Target: $400
 8% 

Play headshot sound to player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ItsMeMaLi
Junior Member
Join Date: Sep 2018
Old 09-18-2018 , 10:39   Play headshot sound to player
Reply With Quote #1

Hi all, I have almost finished modifying DarkGL onlyhs plugin.
This is a version that make different damage according to the weapon and armor of the victim.
The problem is that when a player is killed no "dink" sound is made.
I'm trying with
PHP Code:
EmitSoundToClient(victim"Player.DeathHeadShot");
EmitSoundToClient(attacker"Player.DeathHeadShot"); 
but it doesn't work.
Could you help me?
I leave the rest of the code down here

PHP Code:
public Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3], int damagecustom){
    
    
    if( !
IsClientValidvictim ) || !IsClientValidattacker ) ){
        return 
Plugin_Continue;
    }
    
    if( 
aimOnattacker ] ){
        
char sWeapon[32];
        
GetClientWeapon(attackersWeaponsizeof(sWeapon));
        
int iHelmet GetEntProp(victimProp_Send"m_bHasHelmet");
        if (
iHelmet == 1){
            if( 
strncmp(sWeapon"weapon_ak47",strlen("weapon_ak47"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
EmitSoundToClient(victim"Player.DeathHeadShot");
                
EmitSoundToClient(attacker"Player.DeathHeadShot");
                
damage 111.0;
            }
            if( 
strncmp(sWeapon"weapon_glock",strlen("weapon_glock"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 55.0;
            }
            if( 
strncmp(sWeapon"weapon_deagle",strlen("weapon_deagle"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 132.0;
            }
            if( 
strncmp(sWeapon"weapon_m4a1_silencer",strlen("weapon_m4a1_silencer"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 92.0;
            }
            if( 
strncmp(sWeapon"weapon_m4a1",strlen("weapon_m4a1"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 92.0;
            }
            if( 
strncmp(sWeapon"weapon_usp_silencer",strlen("weapon_usp_silencer"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 70.0;
            }
            if( 
strncmp(sWeapon"weapon_fiveseven",strlen("weapon_fiveseven"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 115.0;
            }
            if( 
strncmp(sWeapon"weapon_p250",strlen("weapon_p250"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 96.0;
            }
            if( 
strncmp(sWeapon"weapon_cz75a",strlen("weapon_cz75a"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 95.0;
            }
        }
        else {
            if( 
strncmp(sWeapon"weapon_ak47",strlen("weapon_ak47"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 146.0;
            }
            if( 
strncmp(sWeapon"weapon_glock",strlen("weapon_glock"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 101.0;
            }
            if( 
strncmp(sWeapon"weapon_deagle",strlen("weapon_deagle"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 149.0;
            }
            if( 
strncmp(sWeapon"weapon_m4a1_silencer",strlen("weapon_m4a1_silencer"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 131.0;
            }
            if( 
strncmp(sWeapon"weapon_m4a1",strlen("weapon_m4a1"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 131.0;
            }
            if( 
strncmp(sWeapon"weapon_usp_silencer",strlen("weapon_usp_silencer"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 121.0;
            }
            if( 
strncmp(sWeapon"weapon_fiveseven",strlen("weapon_fiveseven"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 107.0;
            }
            if( 
strncmp(sWeapon"weapon_p250",strlen("weapon_p250"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 151.0;
            }
            if( 
strncmp(sWeapon"weapon_cz75a",strlen("weapon_cz75a"))== 0){
                
damagetype CS_DMG_HEADSHOT;
                
damage 123.0;
            }    
        }
        return 
Plugin_Changed;
    }
    
    return 
Plugin_Continue;


Last edited by ItsMeMaLi; 09-18-2018 at 10:40.
ItsMeMaLi is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 09-18-2018 , 11:51   Re: Play headshot sound to player
Reply With Quote #2

Quote:
Originally Posted by ItsMeMaLi View Post
PHP Code:
EmitSoundToClient(victim"Player.DeathHeadShot");
EmitSoundToClient(attacker"Player.DeathHeadShot"); 
but it doesn't work.
Of course not.

You need to tell the function where to get the sounds from.

Edit:

For example, "sounds/anime/onepiece/mugiwara.mp3".

Last edited by mug1wara; 09-18-2018 at 11:52.
mug1wara is offline
ItsMeMaLi
Junior Member
Join Date: Sep 2018
Old 09-18-2018 , 12:03   Re: Play headshot sound to player
Reply With Quote #3

PHP Code:
float location;
GetEntPropString(victimProp_Send"m_szLastPlaceName"locationsizeof(location));
EmitAmbientGameSound("sounds/headshot1.mp3"location
Something like that should work instead?
ItsMeMaLi is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 09-18-2018 , 13:43   Re: Play headshot sound to player
Reply With Quote #4

Quote:
Originally Posted by ItsMeMaLi View Post
PHP Code:
float location;
GetEntPropString(victimProp_Send"m_szLastPlaceName"locationsizeof(location)); 
Something like that should work instead?
Last param is a string, not a float.

And I see no use of this.
mug1wara is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-18-2018 , 15:18   Re: Play headshot sound to player
Reply With Quote #5

Try using EmitGameSoundToClient instead, assuming Valve didn't break it on CS:GO.

Edit: The various EmitGameSound functions are so you can use things like Player.DeathHeadShot instead of getting the mp3 name from the game_sound.txt (or similar) files.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 09-18-2018 at 15:21.
Powerlord is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 09-20-2018 , 04:32   Re: Play headshot sound to player
Reply With Quote #6

Quote:
Originally Posted by Powerlord View Post
Try using EmitGameSoundToClient instead, assuming Valve didn't break it on CS:GO.

Edit: The various EmitGameSound functions are so you can use things like Player.DeathHeadShot instead of getting the mp3 name from the game_sound.txt (or similar) files.
It probably did.

Check my plugin for indication:

https://forums.alliedmods.net/showthread.php?p=2597959
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
ItsMeMaLi
Junior Member
Join Date: Sep 2018
Old 09-26-2018 , 09:30   Re: Play headshot sound to player
Reply With Quote #7

I did use the way eyal used to play headshot sound but instead of using wav like he does, i used the game_sounds.txt (Player.headshot)
It worked soon I will publish the pluin with obv eyal credit too.
ItsMeMaLi is offline
Reply


Thread Tools
Display Modes

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 18:17.


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