Raised This Month: $158 Target: $400
 39% 

fix a plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mankled
Member
Join Date: Oct 2019
Old 11-27-2019 , 02:24   fix a plugin
Reply With Quote #1

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

Mankled is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 11-27-2019 , 11:48   Re: fix a plugin
Reply With Quote #2

Please be more descriptive as to your problem and post any compilation errors and/or server logs.
__________________
Discord: wEight#6773

Hobbies:
- Map Designing (Any Half-Life 1 Engine Game)
- Pawn (Intermediate / Counter-Strike 1.6 only)
- C#/VB for .Net (Intermediate / Winforms)
- Java (Mostly Android Application Development)
redivcram is online now
Mankled
Member
Join Date: Oct 2019
Old 11-27-2019 , 14:04   Re: fix a plugin
Reply With Quote #3

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

Last edited by Mankled; 11-27-2019 at 14:05.
Mankled is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 11-27-2019 , 14:46   Re: fix a plugin
Reply With Quote #4

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.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar,get_pcvar_num(pCvar) ? 1); 
^SmileY is online now
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Mankled
Member
Join Date: Oct 2019
Old 11-28-2019 , 00:47   Re: fix a plugin
Reply With Quote #5

Quote:
Originally Posted by ^SmileY View Post
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 is offline
Mankled
Member
Join Date: Oct 2019
Old 11-29-2019 , 13:37   Re: fix a plugin
Reply With Quote #6

UP
Mankled is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-29-2019 , 14:48   Re: fix a plugin
Reply With Quote #7

What did you exactly try (if anything) from the last post in this thread to say that it's still not working?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Mankled
Member
Join Date: Oct 2019
Old 12-03-2019 , 00:55   Re: fix a plugin
Reply With Quote #8

could someone help me? please
Mankled is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-03-2019 , 08:36   Re: fix a plugin
Reply With Quote #9

Don't be ignorant.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Shadows Adi
Junior Member
Join Date: Aug 2019
Location: Romania
Old 12-03-2019 , 10:04   Re: fix a plugin
Reply With Quote #10

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;

__________________
Shadows Adi 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 18:24.


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