Thread: fix a plugin
View Single Post
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 12-03-2019 , 09: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;

__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline