
/* AMX Mod script.
*
* (c) Copyright 2002, OLO
* This file is provided as is (no warranties).
*
*/

#include <amxmod>

/* cvar:
*  set max. frequency of chating
*  amx_flood_time < time in sec. >
*/

new Float:flooding[33]
public check_flooding(id){
	new Float:max_chat = get_cvar_float("amx_flood_time")
	if (max_chat){
		new Float:ntime = get_gametime()
		if (flooding[id] > ntime) {
			client_print(id,print_notify,"[AMX] Stop flooding the server!")
			flooding[id] = ntime + max_chat * 5.0
			return PLUGIN_HANDLED
		}
		flooding[id] = ntime + max_chat
	}
	return PLUGIN_CONTINUE
}
public plugin_init() {
	register_plugin("Anti Flood","0.6","default")
	register_clcmd("say","check_flooding")
	register_clcmd("say_team","check_flooding")
	register_cvar("amx_flood_time","0.75")
	return PLUGIN_CONTINUE
}

