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

[REQ] Anti Chat Flood


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mankled
Senior Member
Join Date: Oct 2019
Old 11-06-2019 , 00:49   [REQ] Anti Chat Flood
Reply With Quote #1

i was looking for an anti chat flood, but i couldn't find what i want, so can some scripter make it ?
it works like this: if somebody say the same message more than X times he will be muted for X seconds.
Mankled is offline
SomewhereLost
AlliedModders Donor
Join Date: Mar 2014
Location: Tomorrowland
Old 11-07-2019 , 21:22   Re: [REQ] Anti Chat Flood
Reply With Quote #2

I dont know about the same message, but AMXX has its own anti flood.

Quote:
amx_flood_time 0.75
__________________
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
Mankled
Senior Member
Join Date: Oct 2019
Old 11-08-2019 , 10:59   Re: [REQ] Anti Chat Flood
Reply With Quote #3

But I need with limit of X messages to mute for X seconds
Mankled is offline
Mankled
Senior Member
Join Date: Oct 2019
Old 11-11-2019 , 13:00   Re: [REQ] Anti Chat Flood
Reply With Quote #4

UP
Mankled is offline
ZaX
Senior Member
Join Date: Jan 2015
Old 11-12-2019 , 07:37   Re: [REQ] Anti Chat Flood
Reply With Quote #5

PHP Code:
 #include <amxmodx>

//Uncomment the line bellow to avoid chat duplicates
//#define AVOID_DUPLICATES 

#define SPAM_MAXCOUNT 4
#define BLOCK_DURATION 30
#define CHAT_DELAY 1.5

new Float:g_flChatDelay[33], bool:g_bMuted[33], g_iCount[33]

#if defined AVOID_DUPLICATES
new g_MsgSay
#endif

public plugin_init()
{
    
register_plugin("ANTI CHAT SPAMMER""1.0""ZinoZack47")
    
register_clcmd("say""HookSay")
    
register_clcmd("say_team""HookSay")

    
#if defined AVOID_DUPLICATES
    
g_MsgSay get_user_msgid ("SayText")
    
register_message(g_MsgSay"avoid_duplicated")
    
#endif
}

#if defined AVOID_DUPLICATES
public avoid_duplicated(MsgIdMsgDestReceiver)
    return 
PLUGIN_HANDLED
#endif

public HookSay(id)
{
    if (
g_bMuted[id])
        return 
PLUGIN_HANDLED

    
static szMsg[192]
    
read_args(szMsgcharsmax(szMsg))
    
remove_quotes(szMsg)

    if(!
szMsg[0] || szMsg[0] == '/' || szMsg[0] == '@' || szMsg[0] == '!')
        return 
PLUGIN_CONTINUE;

    if (
get_gametime() - g_flChatDelay[id] < CHAT_DELAY)
    {
        
g_flChatDelay[id] = get_gametime()
        
g_iCount[id]++
        if(
g_iCount[id] > SPAM_MAXCOUNT)
        {
            
client_print(idprint_center"You have been muted for %d Seconds"BLOCK_DURATION)
            
g_bMuted[id] = true
            set_task
(float(BLOCK_DURATION), "UnmutePlayer"id)
            return 
PLUGIN_HANDLED
        
}
    }

    return 
PLUGIN_CONTINUE
}

public 
UnmutePlayer(id)
{
    
g_bMuted[id] = false
    g_iCount
[id] = 0
}

public 
client_disconnected(id)
{
    
g_bMuted[id] = false
    g_iCount
[id] = 0
    g_flChatDelay
[id] = 0.0

Try this
Im not the author

Last edited by ZaX; 11-12-2019 at 07:37.
ZaX is offline
Mankled
Senior Member
Join Date: Oct 2019
Old 11-13-2019 , 23:24   Re: [REQ] Anti Chat Flood
Reply With Quote #6

Quote:
Originally Posted by ZaX View Post
PHP Code:
 #include <amxmodx>

//Uncomment the line bellow to avoid chat duplicates
//#define AVOID_DUPLICATES 

#define SPAM_MAXCOUNT 4
#define BLOCK_DURATION 30
#define CHAT_DELAY 1.5

new Float:g_flChatDelay[33], bool:g_bMuted[33], g_iCount[33]

#if defined AVOID_DUPLICATES
new g_MsgSay
#endif

public plugin_init()
{
    
register_plugin("ANTI CHAT SPAMMER""1.0""ZinoZack47")
    
register_clcmd("say""HookSay")
    
register_clcmd("say_team""HookSay")

    
#if defined AVOID_DUPLICATES
    
g_MsgSay get_user_msgid ("SayText")
    
register_message(g_MsgSay"avoid_duplicated")
    
#endif
}

#if defined AVOID_DUPLICATES
public avoid_duplicated(MsgIdMsgDestReceiver)
    return 
PLUGIN_HANDLED
#endif

public HookSay(id)
{
    if (
g_bMuted[id])
        return 
PLUGIN_HANDLED

    
static szMsg[192]
    
read_args(szMsgcharsmax(szMsg))
    
remove_quotes(szMsg)

    if(!
szMsg[0] || szMsg[0] == '/' || szMsg[0] == '@' || szMsg[0] == '!')
        return 
PLUGIN_CONTINUE;

    if (
get_gametime() - g_flChatDelay[id] < CHAT_DELAY)
    {
        
g_flChatDelay[id] = get_gametime()
        
g_iCount[id]++
        if(
g_iCount[id] > SPAM_MAXCOUNT)
        {
            
client_print(idprint_center"You have been muted for %d Seconds"BLOCK_DURATION)
            
g_bMuted[id] = true
            set_task
(float(BLOCK_DURATION), "UnmutePlayer"id)
            return 
PLUGIN_HANDLED
        
}
    }

    return 
PLUGIN_CONTINUE
}

public 
UnmutePlayer(id)
{
    
g_bMuted[id] = false
    g_iCount
[id] = 0
}

public 
client_disconnected(id)
{
    
g_bMuted[id] = false
    g_iCount
[id] = 0
    g_flChatDelay
[id] = 0.0

Try this
Im not the author

it didn't work, i was flooding the chat more than 4 times, like 10 and nothing happen
Mankled is offline
Mankled
Senior Member
Join Date: Oct 2019
Old 11-15-2019 , 23:43   Re: [REQ] Anti Chat Flood
Reply With Quote #7

UP
Mankled is offline
Mankled
Senior Member
Join Date: Oct 2019
Old 11-19-2019 , 22:53   Re: [REQ] Anti Chat Flood
Reply With Quote #8

help
Mankled is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 11-22-2019 , 13:27   Re: [REQ] Anti Chat Flood
Reply With Quote #9

Code:
#include <amxmodx>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

#define MAX_FLOOD_REPEAT	4
#define MIN_FLOOD_TIME 		0.75
#define MIN_FLOOD_NEXT_TIME	4.0

new g_Flood[MAX_PLAYERS+1];
new Float:g_Flooding[MAX_PLAYERS+1];

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)

	register_clcmd("say","HookSay");
	register_clcmd("say_team","HookSay");
}

public HookSay(id)
{
	new Float:NexTime = get_gametime();
		
	if(g_Flooding[id] > NexTime)
	{
		if(g_Flood[id] >= MAX_FLOOD_REPEAT)
		{
			//client_print(id, print_center, "You flood the chat/console and mute for %d Seconds", g_Flood)
			g_Flooding[id] = NexTime + MIN_FLOOD_TIME + MIN_FLOOD_NEXT_TIME;
			return PLUGIN_HANDLED;
		}

		g_Flood[id]++;
	}
	else if(g_Flood[id])
	{
		g_Flood[id]--;
	}
		
	g_Flooding[id] = NexTime + MIN_FLOOD_TIME;

	return PLUGIN_CONTINUE;
}
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Mankled
Senior Member
Join Date: Oct 2019
Old 11-23-2019 , 00:16   Re: [REQ] Anti Chat Flood
Reply With Quote #10

Quote:
Originally Posted by Fuck For Fun View Post
Code:
#include <amxmodx>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

#define MAX_FLOOD_REPEAT	4
#define MIN_FLOOD_TIME 		0.75
#define MIN_FLOOD_NEXT_TIME	4.0

new g_Flood[MAX_PLAYERS+1];
new Float:g_Flooding[MAX_PLAYERS+1];

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)

	register_clcmd("say","HookSay");
	register_clcmd("say_team","HookSay");
}

public HookSay(id)
{
	new Float:NexTime = get_gametime();
		
	if(g_Flooding[id] > NexTime)
	{
		if(g_Flood[id] >= MAX_FLOOD_REPEAT)
		{
			//client_print(id, print_center, "You flood the chat/console and mute for %d Seconds", g_Flood)
			g_Flooding[id] = NexTime + MIN_FLOOD_TIME + MIN_FLOOD_NEXT_TIME;
			return PLUGIN_HANDLED;
		}

		g_Flood[id]++;
	}
	else if(g_Flood[id])
	{
		g_Flood[id]--;
	}
		
	g_Flooding[id] = NexTime + MIN_FLOOD_TIME;

	return PLUGIN_CONTINUE;
}

i couldn't compile it
PHP Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c1997-2013 ITB CompuPhaseAMX Mod X Team

Error
Undefined symbol "MAX_PLAYERS" on line 11
Error
Invalid array size (negative or zeroon line 11
Error
Undefined symbol "MAX_PLAYERS" on line 12
Error
Invalid array size (negative or zeroon line 12

4 Errors
.
Could not locate output file C:\Users\Mankled\Desktop\anti_flood2.amx (compile failed). 
Mankled 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 21:21.


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