AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Blocking Death Sound Questions (https://forums.alliedmods.net/showthread.php?t=251041)

mapper07 11-04-2014 15:27

Blocking Death Sound Questions
 
I am trying to block players from emitting the sounds made upon death.
I don't want this to happen all the time, I simply need to to occur if certain conditions are met.
For example, if the killer is using a USP, the victim should not emit any of the death sounds.
At first I thought I should do this at FM_EmitSound but then thought I might have to at DeathMsg. Can someone suggest which would work better and why?

Baws 12-16-2015 00:41

Re: Blocking Death Sound Questions
 
On deathmessage, because it's better to do it on sight.

Bugsy 12-18-2015 22:18

Re: Blocking Death Sound Questions
 
I would do it at EmitSound since you can block it here easily.

You need to check two conditions for this:
  • Check if the player who is emitting the sound is dead because it is the only sound a dead player will ever make.
  • Check to see if the killers weapon is one of the blocked weapons and if so block the sound.
This will block death sound if killed by usp or glock. This will only work with guns/knife and not grenades, but can be modified to support grenades.
PHP Code:


#include <amxmodx>
#include <fakemeta>

new const Version[] = "0.1";

#define MAX_PLAYERS 32

#define IsPlayer(%1)    (1<=%1<=MAX_PLAYERS)

const g_IgnoreGuns = ( << CSW_USP << CSW_GLOCK18 );

new 
g_KillerMAX_PLAYERS ];

public 
plugin_init()
{
    
register_plugin"Block Death Sound" Version "bugsy" );
    
    
register_forwardFM_EmitSound "EmitSound" );
    
register_event"DeathMsg" "DeathMsg" "a" "1>0" );
}

public 
EmitSoundiEntity iChannel , const szSample[] , Float:fVolume Float:fAtten Flags Pitch 
{
    return ( 
IsPlayeriEntity ) && !is_user_aliveiEntity ) && ( g_IgnoreGuns & ( << get_user_weapong_KilleriEntity ] ) ) ) ) ? FMRES_SUPERCEDE FMRES_IGNORED;
}

public 
DeathMsg()
{
    
g_Killerread_data) ] = read_data);




All times are GMT -4. The time now is 17:42.

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