AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   fix a plugin (https://forums.alliedmods.net/showthread.php?t=319932)

Mankled 11-27-2019 02:24

fix a plugin
 
can someone fix this plugin, cus isn't working

PHP Code:

#include <amxmodx>

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

#define SPAM_MAXCOUNT 3
#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



redivcram 11-27-2019 11:48

Re: fix a plugin
 
Please be more descriptive as to your problem and post any compilation errors and/or server logs.

Mankled 11-27-2019 14:04

Re: fix a plugin
 
there's no erros when compiling, but in-game it doesn't work. its an anti chat flood, when the player says the same message more than X times less than X time, he will be muted for X time.



@EDIT
i say the same message more than 10 times and it doesn't work when "#define SPAM_MAXCOUNT 3" is 3

^SmileY 11-27-2019 14:46

Re: fix a plugin
 
Code:

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

i guess the problem is here.
Also default amxmodx antiflood.sma package already does that, need to add messages and change values only.

Mankled 11-28-2019 00:47

Re: fix a plugin
 
Quote:

Originally Posted by ^SmileY (Post 2674691)
Code:

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

i guess the problem is here.
Also default amxmodx antiflood.sma package already does that, need to add messages and change values only.

still not working

Mankled 11-29-2019 13:37

Re: fix a plugin
 
UP

OciXCrom 11-29-2019 14:48

Re: fix a plugin
 
What did you exactly try (if anything) from the last post in this thread to say that it's still not working?

Mankled 12-03-2019 00:55

Re: fix a plugin
 
could someone help me? please

OciXCrom 12-03-2019 08:36

Re: fix a plugin
 
Don't be ignorant.

Shadows Adi 12-03-2019 10:04

Re: fix a plugin
 
PHP 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(PLUGINVERSIONAUTHOR)

    
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;




All times are GMT -4. The time now is 23:34.

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