AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [REQ] Anti Chat Flood (https://forums.alliedmods.net/showthread.php?t=319530)

Mankled 11-06-2019 00:49

[REQ] Anti Chat Flood
 
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.

SomewhereLost 11-07-2019 21:22

Re: [REQ] Anti Chat Flood
 
I dont know about the same message, but AMXX has its own anti flood.

Quote:

amx_flood_time 0.75

Mankled 11-08-2019 10:59

Re: [REQ] Anti Chat Flood
 
But I need with limit of X messages to mute for X seconds

Mankled 11-11-2019 13:00

Re: [REQ] Anti Chat Flood
 
UP

ZaX 11-12-2019 07:37

Re: [REQ] Anti Chat Flood
 
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

Mankled 11-13-2019 23:24

Re: [REQ] Anti Chat Flood
 
Quote:

Originally Posted by ZaX (Post 2672709)
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 11-15-2019 23:43

Re: [REQ] Anti Chat Flood
 
UP

Mankled 11-19-2019 22:53

Re: [REQ] Anti Chat Flood
 
help

Fuck For Fun 11-22-2019 13:27

Re: [REQ] Anti Chat Flood
 
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;
}


Mankled 11-23-2019 00:16

Re: [REQ] Anti Chat Flood
 
Quote:

Originally Posted by Fuck For Fun (Post 2674030)
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). 



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

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