Raised This Month: $ Target: $400
 0% 

Solved [Request] Anti Spam of Use Sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JocAnis
Veteran Member
Join Date: Jun 2010
Old 09-25-2020 , 20:41   Re: [Request] Anti Spam of Use Sound
Reply With Quote #1

yo Snake, can you test this?

Need only to change USE_TIME to your value which is fine for you, i find 0.3sec is good for me:

Code:
#include <amxmodx>
#include <fakemeta>

#define USE_TIME 0.3

new Float: g_fUseTime[ 33 ]

public plugin_init( )
{
	register_plugin( "Block Spam +Use", "1.0", "internet provider" )

	register_forward( FM_EmitSound, "block_sound" )
}
public client_putinserver( id )
{
    g_fUseTime[ id ] = 0.0
}
public block_sound( entity, channel, const sound[] ) //Alucard^ credits
{
    if( equali( sound, "common/wpn_denyselect.wav" ) && get_gametime() - g_fUseTime[ entity ] < USE_TIME )
    {
        g_fUseTime[ entity ] = get_gametime()
        return FMRES_SUPERCEDE
    }
    g_fUseTime[ entity ] = get_gametime()
    return FMRES_IGNORED
}
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)

Last edited by JocAnis; 09-25-2020 at 20:48.
JocAnis is offline
Snake.
Senior Member
Join Date: Jul 2017
Old 09-26-2020 , 07:23   Re: [Request] Anti Spam of Use Sound
Reply With Quote #2

Quote:
Originally Posted by JocAnis View Post
yo Snake, can you test this?

Need only to change USE_TIME to your value which is fine for you, i find 0.3sec is good for me:

Code:
#include <amxmodx>
#include <fakemeta>

#define USE_TIME 0.3

new Float: g_fUseTime[ 33 ]

public plugin_init( )
{
	register_plugin( "Block Spam +Use", "1.0", "internet provider" )

	register_forward( FM_EmitSound, "block_sound" )
}
public client_putinserver( id )
{
    g_fUseTime[ id ] = 0.0
}
public block_sound( entity, channel, const sound[] ) //Alucard^ credits
{
    if( equali( sound, "common/wpn_denyselect.wav" ) && get_gametime() - g_fUseTime[ entity ] < USE_TIME )
    {
        g_fUseTime[ entity ] = get_gametime()
        return FMRES_SUPERCEDE
    }
    g_fUseTime[ entity ] = get_gametime()
    return FMRES_IGNORED
}
Thanks. <3
Snake. is offline
Send a message via Skype™ to Snake.
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 23:56.


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