View Single Post
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