[Half-Life AMXX] / antiflood.sma Repository:
ViewVC logotype

Annotation of /antiflood.sma

Parent Directory Parent Directory | Revision Log Revision Log


Revision 17 - (view) (download)

1 : ian 1 /* AMX Mod X
2 :     * Anti Flood Plugin
3 :     *
4 :     * by the AMX Mod X Development Team
5 :     * originally developed by OLO
6 :     *
7 :     * This file is part of AMX Mod X.
8 :     *
9 :     *
10 :     * This program is free software; you can redistribute it and/or modify it
11 :     * under the terms of the GNU General Public License as published by the
12 :     * Free Software Foundation; either version 2 of the License, or (at
13 :     * your option) any later version.
14 :     *
15 :     * This program is distributed in the hope that it will be useful, but
16 :     * WITHOUT ANY WARRANTY; without even the implied warranty of
17 :     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 :     * General Public License for more details.
19 :     *
20 :     * You should have received a copy of the GNU General Public License
21 :     * along with this program; if not, write to the Free Software Foundation,
22 :     * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 :     *
24 :     * In addition, as a special exception, the author gives permission to
25 :     * link the code of this program with the Half-Life Game Engine ("HL
26 :     * Engine") and Modified Game Libraries ("MODs") developed by Valve,
27 :     * L.L.C ("Valve"). You must obey the GNU General Public License in all
28 :     * respects for all of the code used other than the HL Engine and MODs
29 :     * from Valve. If you modify this file, you may extend this exception
30 :     * to your version of the file, but you are not obligated to do so. If
31 :     * you do not wish to do so, delete this exception statement from your
32 :     * version.
33 :     */
34 :    
35 :     #include <amxmodx>
36 :    
37 :     new Float:g_Flooding[33] = {0.0, ...}
38 :     new g_Flood[33] = {0, ...}
39 :    
40 : ian 17 new amx_flood_time;
41 :    
42 : ian 1 public plugin_init()
43 :     {
44 :     register_plugin("Anti Flood", AMXX_VERSION_STR, "AMXX Dev Team")
45 :     register_dictionary("antiflood.txt")
46 :     register_clcmd("say", "chkFlood")
47 :     register_clcmd("say_team", "chkFlood")
48 : ian 17 amx_flood_time=register_cvar("amx_flood_time", "0.75")
49 : ian 1 }
50 :    
51 :     public chkFlood(id)
52 :     {
53 : ian 17 new Float:maxChat = get_pcvar_float(amx_flood_time)
54 : ian 1
55 :     if (maxChat)
56 :     {
57 :     new Float:nexTime = get_gametime()
58 :    
59 :     if (g_Flooding[id] > nexTime)
60 :     {
61 :     if (g_Flood[id] >= 3)
62 :     {
63 :     client_print(id, print_notify, "** %L **", id, "STOP_FLOOD")
64 :     g_Flooding[id] = nexTime + maxChat + 3.0
65 :     return PLUGIN_HANDLED
66 :     }
67 :     g_Flood[id]++
68 :     }
69 :     else if (g_Flood[id])
70 :     {
71 :     g_Flood[id]--
72 :     }
73 :    
74 :     g_Flooding[id] = nexTime + maxChat
75 :     }
76 :    
77 :     return PLUGIN_CONTINUE
78 :     }

Contact
ViewVC Help
Powered by ViewVC 1.0.4