|
ds@1952
|
1 |
/** |
|
ds@1952
|
2 |
* vim: set ts=4 : |
|
ds@1952
|
3 |
* ============================================================================= |
|
ds@1952
|
4 |
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved. |
|
ds@1952
|
5 |
* ============================================================================= |
|
ds@1952
|
6 |
* |
|
ds@1952
|
7 |
* This file is part of the SourceMod/SourcePawn SDK. |
|
ds@1952
|
8 |
* |
|
ds@1952
|
9 |
* This program is free software; you can redistribute it and/or modify it under |
|
ds@1952
|
10 |
* the terms of the GNU General Public License, version 3.0, as published by the |
|
ds@1952
|
11 |
* Free Software Foundation. |
|
ds@1952
|
12 |
* |
|
ds@1952
|
13 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
ds@1952
|
14 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
ds@1952
|
15 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
ds@1952
|
16 |
* details. |
|
ds@1952
|
17 |
* |
|
ds@1952
|
18 |
* You should have received a copy of the GNU General Public License along with |
|
ds@1952
|
19 |
* this program. If not, see <http://www.gnu.org/licenses/>. |
|
ds@1952
|
20 |
* |
|
ds@1952
|
21 |
* As a special exception, AlliedModders LLC gives you permission to link the |
|
ds@1952
|
22 |
* code of this program (as well as its derivative works) to "Half-Life 2," the |
|
ds@1952
|
23 |
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software |
|
ds@1952
|
24 |
* by the Valve Corporation. You must obey the GNU General Public License in |
|
ds@1952
|
25 |
* all respects for all other code used. Additionally, AlliedModders LLC grants |
|
ds@1952
|
26 |
* this exception to all derivative works. AlliedModders LLC defines further |
|
ds@1952
|
27 |
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), |
|
ds@1952
|
28 |
* or <http://www.sourcemod.net/license.php>. |
|
ds@1952
|
29 |
* |
|
ds@1952
|
30 |
* Version: $Id$ |
|
ds@1952
|
31 |
*/ |
|
ds@1952
|
32 |
|
|
ds@1952
|
33 |
#if defined _banning_included |
|
ds@1952
|
34 |
#endinput |
|
ds@1952
|
35 |
#endif |
|
ds@1952
|
36 |
#define _banning_included |
|
ds@1952
|
37 |
|
|
ds@1952
|
38 |
#define BANFLAG_AUTO (1<<0) /**< Auto-detects whether to ban by steamid or IP */ |
|
ds@1952
|
39 |
#define BANFLAG_IP (1<<1) /**< Always ban by IP address */ |
|
ds@1952
|
40 |
#define BANFLAG_AUTHID (1<<2) /**< Always ban by authstring (for BanIdentity) if possible */ |
|
ds@1952
|
41 |
#define BANFLAG_NOKICK (1<<3) /**< Does not kick the client */ |
|
ds@1952
|
42 |
|
|
ds@1952
|
43 |
/** |
|
ds@1952
|
44 |
* Called for calls to BanClient() with a non-empty command. |
|
ds@1952
|
45 |
* |
|
ds@1952
|
46 |
* @param client Client being banned. |
|
ds@1952
|
47 |
* @param time Time the client is being banned for (0 = permanent). |
|
ds@1952
|
48 |
* @param flags One if AUTHID or IP will be enabled. If AUTO is also |
|
ds@1952
|
49 |
* enabled, it means Core autodetected which to use. |
|
ds@1952
|
50 |
* @param reason Reason passed via BanClient(). |
|
ds@1952
|
51 |
* @param kick_message Kick message passed via BanClient(). |
|
ds@1952
|
52 |
* @param command Command string to identify the ban source. |
|
ds@1952
|
53 |
* @param source Source value passed via BanClient(). |
|
ds@1952
|
54 |
* @return Plugin_Handled to block the actual server banning. |
|
ds@1952
|
55 |
* Kicking will still occur. |
|
ds@1952
|
56 |
*/ |
|
ds@1952
|
57 |
forward Action:OnBanClient(client, |
|
ds@1952
|
58 |
time, |
|
ds@1952
|
59 |
flags, |
|
ds@1952
|
60 |
const String:reason[], |
|
ds@1952
|
61 |
const String:kick_message[], |
|
ds@1952
|
62 |
const String:command[], |
|
ds@1952
|
63 |
any:source); |
|
ds@1952
|
64 |
|
|
ds@1952
|
65 |
/** |
|
ds@1952
|
66 |
* Called for calls to BanIdentity() with a non-empty command. |
|
ds@1952
|
67 |
* |
|
ds@1952
|
68 |
* @param identity Identity string being banned (authstring or ip). |
|
ds@1952
|
69 |
* @param time Time the client is being banned for (0 = permanent). |
|
ds@1952
|
70 |
* @param flags Ban flags (only IP or AUTHID are valid here). |
|
ds@1952
|
71 |
* @param reason Reason passed via BanIdentity(). |
|
ds@1952
|
72 |
* @param command Command string to identify the ban source. |
|
ds@1952
|
73 |
* @param source Source value passed via BanIdentity(). |
|
ds@1952
|
74 |
* @return Plugin_Handled to block the actual server banning. |
|
ds@1952
|
75 |
*/ |
|
ds@1952
|
76 |
forward Action:OnBanIdentity(const String:identity[], |
|
ds@1952
|
77 |
time, |
|
ds@1952
|
78 |
flags, |
|
ds@1952
|
79 |
const String:reason[], |
|
ds@1952
|
80 |
const String:command[], |
|
ds@1952
|
81 |
any:source); |
|
ds@1952
|
82 |
|
|
ds@1952
|
83 |
/** |
|
ds@1952
|
84 |
* Called for calls to RemoveBan() with a non-empty command. |
|
ds@1952
|
85 |
* |
|
ds@1952
|
86 |
* @param identity Identity string being banned (authstring or ip). |
|
ds@1952
|
87 |
* @param flags Ban flags (only IP or AUTHID are valid here). |
|
ds@1952
|
88 |
* @param command Command string to identify the ban source. |
|
ds@1952
|
89 |
* @param source Source value passed via BanIdentity(). |
|
ds@1952
|
90 |
* @return Plugin_Handled to block the actual server banning. |
|
ds@1952
|
91 |
*/ |
|
ds@1952
|
92 |
forward Action:OnRemoveBan(const String:identity[], |
|
ds@1952
|
93 |
flags, |
|
ds@1952
|
94 |
const String:command[], |
|
ds@1952
|
95 |
any:source); |
|
ds@1952
|
96 |
|
|
ds@1952
|
97 |
/** |
|
ds@1952
|
98 |
* Bans a client. |
|
ds@1952
|
99 |
* |
|
ds@1952
|
100 |
* @param client Client being banned. |
|
ds@1952
|
101 |
* @param time Time (in minutes) to ban (0 = permanent). |
|
ds@1952
|
102 |
* @param flags Flags for controlling the ban mechanism. If AUTHID |
|
ds@1952
|
103 |
* is set and no AUTHID is available, the ban will fail |
|
ds@1952
|
104 |
* unless AUTO is also flagged. |
|
ds@1952
|
105 |
* @param reason Reason to ban the client for. |
|
ds@1952
|
106 |
* @param kick_message Message to display to the user when kicking. |
|
ds@1952
|
107 |
* @param command Command string to identify the source. If this is left |
|
ds@1952
|
108 |
* empty, then the OnBanClient forward will not be called. |
|
ds@1952
|
109 |
* @param source A source value that could be interpreted as a player |
|
ds@1952
|
110 |
* index of any sort (not actually checked by Core). |
|
ds@1952
|
111 |
* @return True on success, false on failure. |
|
ds@1952
|
112 |
* @error Invalid client index or client not in game. |
|
ds@1952
|
113 |
*/ |
|
ds@1952
|
114 |
native bool:BanClient(client, |
|
ds@1952
|
115 |
time, |
|
ds@1952
|
116 |
flags, |
|
ds@1952
|
117 |
const String:reason[], |
|
ds@1952
|
118 |
const String:kick_message[]="", |
|
ds@1952
|
119 |
const String:command[]="", |
|
ds@1952
|
120 |
any:source=0); |
|
ds@1952
|
121 |
|
|
ds@1952
|
122 |
/** |
|
ds@1952
|
123 |
* Bans an identity (either an IP address or auth string). |
|
ds@1952
|
124 |
* |
|
ds@1952
|
125 |
* @param identity String to ban (ip or authstring). |
|
ds@1952
|
126 |
* @param time Time to ban for (0 = permanent). |
|
ds@1952
|
127 |
* @param flags Flags (only IP and AUTHID are valid flags here). |
|
ds@1952
|
128 |
* @param reason Ban reason string. |
|
ds@1952
|
129 |
* @param command Command string to identify the source. If this is left |
|
ds@1952
|
130 |
* empty, then the OnBanIdentity forward will not be called. |
|
ds@1952
|
131 |
* @param source A source value that could be interpreted as a player |
|
ds@1952
|
132 |
* index of any sort (not actually checked by Core). |
|
ds@1952
|
133 |
* @return True on success, false on failure. |
|
ds@1952
|
134 |
*/ |
|
ds@1952
|
135 |
native bool:BanIdentity(const String:identity[], |
|
ds@1952
|
136 |
time, |
|
ds@1952
|
137 |
flags, |
|
ds@1952
|
138 |
const String:reason[], |
|
ds@1952
|
139 |
const String:command[]="", |
|
ds@1952
|
140 |
any:source=0); |
|
ds@1952
|
141 |
|
|
ds@1952
|
142 |
/** |
|
ds@1952
|
143 |
* Removes a ban that was written to the server (either in memory or on disk). |
|
ds@1952
|
144 |
* |
|
ds@1952
|
145 |
* @param identity String to unban (ip or authstring). |
|
ds@1952
|
146 |
* @param flags Flags (only IP and AUTHID are valid flags here). |
|
pred@2111
|
147 |
* @param command Command string to identify the source. If this is left |
|
ds@1952
|
148 |
* empty, then OnRemoveBan will not be called. |
|
ds@1952
|
149 |
* @param source A source value that could be interpreted as a player |
|
ds@1952
|
150 |
* index of any sort (not actually checked by Core). |
|
ds@1952
|
151 |
* @return True on success, false on failure. |
|
ds@1952
|
152 |
*/ |
|
ds@1952
|
153 |
native bool:RemoveBan(const String:identity[], |
|
ds@1952
|
154 |
flags, |
|
ds@1952
|
155 |
const String:command[]="", |
|
ds@1952
|
156 |
any:source=0); |
|
ds@1952
|
157 |
|