2014-08-04 12:12:15 +00:00
|
|
|
// vim: set ts=4 sw=4 tw=99 noet:
|
|
|
|
//
|
|
|
|
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
|
|
|
// Copyright (C) The AMX Mod X Development Team.
|
|
|
|
//
|
|
|
|
// This software is licensed under the GNU General Public License, version 3 or higher.
|
|
|
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
|
|
|
// https://alliedmods.net/amxmodx-license
|
|
|
|
|
|
|
|
//
|
|
|
|
// Anti Flood Plugin
|
|
|
|
//
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2004-03-05 19:35:38 +00:00
|
|
|
#include <amxmodx>
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2015-02-01 18:20:55 +00:00
|
|
|
new Float:g_Flooding[MAX_PLAYERS + 1] = {0.0, ...}
|
|
|
|
new g_Flood[MAX_PLAYERS + 1] = {0, ...}
|
2004-01-31 20:56:22 +00:00
|
|
|
|
2007-03-09 03:04:40 +00:00
|
|
|
new amx_flood_time;
|
|
|
|
|
2005-09-12 21:06:24 +00:00
|
|
|
public plugin_init()
|
|
|
|
{
|
|
|
|
register_plugin("Anti Flood", AMXX_VERSION_STR, "AMXX Dev Team")
|
|
|
|
register_dictionary("antiflood.txt")
|
|
|
|
register_clcmd("say", "chkFlood")
|
|
|
|
register_clcmd("say_team", "chkFlood")
|
2007-03-09 03:04:40 +00:00
|
|
|
amx_flood_time=register_cvar("amx_flood_time", "0.75")
|
2004-01-31 20:56:22 +00:00
|
|
|
}
|
|
|
|
|
2005-09-12 21:06:24 +00:00
|
|
|
public chkFlood(id)
|
|
|
|
{
|
2007-03-09 03:04:40 +00:00
|
|
|
new Float:maxChat = get_pcvar_float(amx_flood_time)
|
2004-02-01 18:45:44 +00:00
|
|
|
|
2005-09-12 21:06:24 +00:00
|
|
|
if (maxChat)
|
|
|
|
{
|
|
|
|
new Float:nexTime = get_gametime()
|
|
|
|
|
|
|
|
if (g_Flooding[id] > nexTime)
|
|
|
|
{
|
|
|
|
if (g_Flood[id] >= 3)
|
|
|
|
{
|
|
|
|
client_print(id, print_notify, "** %L **", id, "STOP_FLOOD")
|
|
|
|
g_Flooding[id] = nexTime + maxChat + 3.0
|
|
|
|
return PLUGIN_HANDLED
|
|
|
|
}
|
|
|
|
g_Flood[id]++
|
|
|
|
}
|
|
|
|
else if (g_Flood[id])
|
|
|
|
{
|
|
|
|
g_Flood[id]--
|
|
|
|
}
|
|
|
|
|
|
|
|
g_Flooding[id] = nexTime + maxChat
|
|
|
|
}
|
2004-02-01 18:45:44 +00:00
|
|
|
|
2005-09-12 21:06:24 +00:00
|
|
|
return PLUGIN_CONTINUE
|
|
|
|
}
|