|
ds@1952
|
1 |
/** |
|
ds@1952
|
2 |
* vim: set ts=4 : |
|
ds@1952
|
3 |
* ============================================================================= |
|
ds@1952
|
4 |
* SourceMod |
|
ds@1952
|
5 |
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. |
|
ds@1952
|
6 |
* ============================================================================= |
|
ds@1952
|
7 |
* |
|
ds@1952
|
8 |
* This program is free software; you can redistribute it and/or modify it under |
|
ds@1952
|
9 |
* the terms of the GNU General Public License, version 3.0, as published by the |
|
ds@1952
|
10 |
* Free Software Foundation. |
|
ds@1952
|
11 |
* |
|
ds@1952
|
12 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
ds@1952
|
13 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
ds@1952
|
14 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
ds@1952
|
15 |
* details. |
|
ds@1952
|
16 |
* |
|
ds@1952
|
17 |
* You should have received a copy of the GNU General Public License along with |
|
ds@1952
|
18 |
* this program. If not, see <http://www.gnu.org/licenses/>. |
|
ds@1952
|
19 |
* |
|
ds@1952
|
20 |
* As a special exception, AlliedModders LLC gives you permission to link the |
|
ds@1952
|
21 |
* code of this program (as well as its derivative works) to "Half-Life 2," the |
|
ds@1952
|
22 |
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software |
|
ds@1952
|
23 |
* by the Valve Corporation. You must obey the GNU General Public License in |
|
ds@1952
|
24 |
* all respects for all other code used. Additionally, AlliedModders LLC grants |
|
ds@1952
|
25 |
* this exception to all derivative works. AlliedModders LLC defines further |
|
ds@1952
|
26 |
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), |
|
ds@1952
|
27 |
* or <http://www.sourcemod.net/license.php>. |
|
ds@1952
|
28 |
* |
|
ds@1952
|
29 |
* Version: $Id$ |
|
ds@1952
|
30 |
*/ |
|
ds@1952
|
31 |
|
|
ds@1952
|
32 |
#ifndef _INCLUDE_SOURCEMOD_INTERFACE_IPLAYERHELPERS_H_ |
|
ds@1952
|
33 |
#define _INCLUDE_SOURCEMOD_INTERFACE_IPLAYERHELPERS_H_ |
|
ds@1952
|
34 |
|
|
ds@1952
|
35 |
/** |
|
ds@1952
|
36 |
* @file IPlayerHelpers.h |
|
ds@1952
|
37 |
* @brief Defines basic helper functions for Half-Life 2 clients |
|
ds@1952
|
38 |
*/ |
|
ds@1952
|
39 |
|
|
ds@1952
|
40 |
#include <IShareSys.h> |
|
ds@1952
|
41 |
#include <IAdminSystem.h> |
|
ds@1952
|
42 |
|
|
ds@1952
|
43 |
#define SMINTERFACE_PLAYERMANAGER_NAME "IPlayerManager" |
|
ds@1952
|
44 |
#define SMINTERFACE_PLAYERMANAGER_VERSION 7 |
|
ds@1952
|
45 |
|
|
ds@1952
|
46 |
struct edict_t; |
|
ds@1952
|
47 |
class IPlayerInfo; |
|
ds@1952
|
48 |
|
|
ds@1952
|
49 |
#define SM_REPLY_CONSOLE 0 /**< Reply to console. */ |
|
ds@1952
|
50 |
#define SM_REPLY_CHAT 1 /**< Reply to chat. */ |
|
ds@1952
|
51 |
|
|
ds@1952
|
52 |
namespace SourceMod |
|
ds@1952
|
53 |
{ |
|
ds@1952
|
54 |
/** |
|
ds@1952
|
55 |
* @brief Abstracts some Half-Life 2 and SourceMod properties about clients. |
|
ds@1952
|
56 |
*/ |
|
ds@1952
|
57 |
class IGamePlayer |
|
ds@1952
|
58 |
{ |
|
ds@1952
|
59 |
public: |
|
ds@1952
|
60 |
/** |
|
ds@1952
|
61 |
* @brief Returns the player's name. |
|
ds@1952
|
62 |
* |
|
ds@1952
|
63 |
* @return String containing the player's name, |
|
ds@1952
|
64 |
* or NULL if unavailable. |
|
ds@1952
|
65 |
*/ |
|
ds@1952
|
66 |
virtual const char *GetName() =0; |
|
ds@1952
|
67 |
|
|
ds@1952
|
68 |
/** |
|
ds@1952
|
69 |
* @brief Returns the player's IP address. |
|
ds@1952
|
70 |
* |
|
ds@1952
|
71 |
* @return String containing the player's IP address, |
|
ds@1952
|
72 |
* or NULL if unavailable. |
|
ds@1952
|
73 |
*/ |
|
ds@1952
|
74 |
virtual const char *GetIPAddress() =0; |
|
ds@1952
|
75 |
|
|
ds@1952
|
76 |
/** |
|
ds@1952
|
77 |
* @brief Returns the player's authentication string. |
|
ds@1952
|
78 |
* |
|
ds@1952
|
79 |
* @return String containing the player's auth string. |
|
ds@1952
|
80 |
* May be NULL if unavailable. |
|
ds@1952
|
81 |
*/ |
|
ds@1952
|
82 |
virtual const char *GetAuthString() =0; |
|
ds@1952
|
83 |
|
|
ds@1952
|
84 |
/** |
|
ds@1952
|
85 |
* @brief Returns the player's edict_t structure. |
|
ds@1952
|
86 |
* |
|
ds@1952
|
87 |
* @return edict_t pointer, or NULL if unavailable. |
|
ds@1952
|
88 |
*/ |
|
ds@1952
|
89 |
virtual edict_t *GetEdict() =0; |
|
ds@1952
|
90 |
|
|
ds@1952
|
91 |
/** |
|
ds@1952
|
92 |
* @brief Returns whether the player is in game (putinserver). |
|
ds@1952
|
93 |
* |
|
ds@1952
|
94 |
* @return True if in game, false otherwise. |
|
ds@1952
|
95 |
*/ |
|
ds@1952
|
96 |
virtual bool IsInGame() =0; |
|
ds@1952
|
97 |
|
|
ds@1952
|
98 |
/** |
|
ds@1952
|
99 |
* @brief Returns whether the player is connected. |
|
ds@1952
|
100 |
* |
|
ds@1952
|
101 |
* Note: If this returns true, all above functions except for |
|
ds@1952
|
102 |
* GetAuthString() should return non-NULL results. |
|
ds@1952
|
103 |
* |
|
ds@1952
|
104 |
* @return True if connected, false otherwise. |
|
ds@1952
|
105 |
*/ |
|
ds@1952
|
106 |
virtual bool IsConnected() =0; |
|
ds@1952
|
107 |
|
|
ds@1952
|
108 |
/** |
|
ds@1952
|
109 |
* @brief Returns whether the player is a fake client. |
|
ds@1952
|
110 |
* |
|
ds@1952
|
111 |
* @return True if a fake client, false otherwise. |
|
ds@1952
|
112 |
*/ |
|
ds@1952
|
113 |
virtual bool IsFakeClient() =0; |
|
ds@1952
|
114 |
|
|
ds@1952
|
115 |
/** |
|
ds@1952
|
116 |
* @brief Returns the client's AdminId, if any. |
|
ds@1952
|
117 |
* |
|
ds@1952
|
118 |
* @return AdminId, or INVALID_ADMIN_ID if none. |
|
ds@1952
|
119 |
*/ |
|
ds@1952
|
120 |
virtual AdminId GetAdminId() =0; |
|
ds@1952
|
121 |
|
|
ds@1952
|
122 |
/** |
|
ds@1952
|
123 |
* @brief Sets the client's AdminId. |
|
ds@1952
|
124 |
* |
|
ds@1952
|
125 |
* @param id AdminId to set. |
|
ds@1952
|
126 |
* @param temp If true, the id will be invalidated on disconnect. |
|
ds@1952
|
127 |
*/ |
|
ds@1952
|
128 |
virtual void SetAdminId(AdminId id, bool temp) =0; |
|
ds@1952
|
129 |
|
|
ds@1952
|
130 |
/** |
|
ds@1952
|
131 |
* @brief Returns the client's userid. |
|
ds@1952
|
132 |
* |
|
ds@1952
|
133 |
* @return Userid. |
|
ds@1952
|
134 |
*/ |
|
ds@1952
|
135 |
virtual int GetUserId() =0; |
|
ds@1952
|
136 |
|
|
ds@1952
|
137 |
/** |
|
ds@1952
|
138 |
* @brief Returns the client's language id. |
|
ds@1952
|
139 |
* |
|
ds@1952
|
140 |
* @return Language id. |
|
ds@1952
|
141 |
*/ |
|
ds@1952
|
142 |
virtual unsigned int GetLanguageId() =0; |
|
ds@1952
|
143 |
|
|
ds@1952
|
144 |
/** |
|
ds@1952
|
145 |
* @brief Returns a player's IPlayerInfo object, if any. |
|
ds@1952
|
146 |
* |
|
ds@1952
|
147 |
* @return IPlayerInfo pointer, or NULL if none. |
|
ds@1952
|
148 |
*/ |
|
ds@1952
|
149 |
virtual IPlayerInfo *GetPlayerInfo() =0; |
|
ds@1952
|
150 |
|
|
ds@1952
|
151 |
/** |
|
ds@1952
|
152 |
* @brief Runs through Core's admin authorization checks. If the |
|
ds@1952
|
153 |
* client is already an admin, no checks are performed. |
|
ds@1952
|
154 |
* |
|
ds@1952
|
155 |
* Note that this function operates solely against the in-memory admin |
|
ds@1952
|
156 |
* cache. It will check steamids, IPs, names, and verify a password |
|
ds@1952
|
157 |
* if one exists. To implement other authentication schemes, simply |
|
ds@1952
|
158 |
* don't call this function and use IGamePlayer::SetAdminId() instead. |
|
ds@1952
|
159 |
* |
|
ds@1952
|
160 |
* @return True if access changed, false otherwise. |
|
ds@1952
|
161 |
*/ |
|
ds@1952
|
162 |
virtual bool RunAdminCacheChecks() =0; |
|
ds@1952
|
163 |
|
|
ds@1952
|
164 |
/** |
|
ds@1952
|
165 |
* @brief Notifies all listeners that the client has completed |
|
ds@1952
|
166 |
* all of your post-connection (in-game, auth, admin) checks. |
|
ds@1952
|
167 |
* |
|
ds@1952
|
168 |
* If you returned "false" from OnClientPreAdminCheck(), you must |
|
ds@1952
|
169 |
* ALWAYS manually invoke this function, even if RunAdminCacheChecks() |
|
ds@1952
|
170 |
* failed or you did not assign an AdminId. Failure to call this |
|
ds@1952
|
171 |
* function could result in plugins (such as reservedslots) not |
|
ds@1952
|
172 |
* working properly. |
|
ds@1952
|
173 |
* |
|
ds@1952
|
174 |
* If you are implementing asynchronous fetches, and the client |
|
ds@1952
|
175 |
* disconnects during your fetching process, you should make sure to |
|
ds@1952
|
176 |
* recognize that case and not call this function. That is, do not |
|
ds@1952
|
177 |
* call this function on mismatched PreCheck calls, or on disconnected |
|
ds@1952
|
178 |
* clients. A good way to check this is to pass userids around, which |
|
ds@1952
|
179 |
* are unique per client connection. |
|
ds@1952
|
180 |
* |
|
ds@1952
|
181 |
* Calling this has no effect if it has already been called on the |
|
ds@1952
|
182 |
* given client (thus it is safe for multiple asynchronous plugins to |
|
ds@1952
|
183 |
* call it at various times). |
|
ds@1952
|
184 |
*/ |
|
ds@1952
|
185 |
virtual void NotifyPostAdminChecks() =0; |
|
ds@1952
|
186 |
}; |
|
ds@1952
|
187 |
|
|
ds@1952
|
188 |
/** |
|
ds@1952
|
189 |
* @brief Provides callbacks for important client events. |
|
ds@1952
|
190 |
*/ |
|
ds@1952
|
191 |
class IClientListener |
|
ds@1952
|
192 |
{ |
|
ds@1952
|
193 |
public: |
|
ds@1952
|
194 |
/** |
|
ds@1952
|
195 |
* @brief Returns the current client listener version. |
|
ds@1952
|
196 |
* |
|
ds@1952
|
197 |
* @return Client listener version. |
|
ds@1952
|
198 |
*/ |
|
ds@1952
|
199 |
virtual unsigned int GetClientListenerVersion() |
|
ds@1952
|
200 |
{ |
|
ds@1952
|
201 |
return SMINTERFACE_PLAYERMANAGER_VERSION; |
|
ds@1952
|
202 |
} |
|
ds@1952
|
203 |
public: |
|
ds@1952
|
204 |
/** |
|
ds@1952
|
205 |
* @brief Called when a client requests connection. |
|
ds@1952
|
206 |
* |
|
ds@1952
|
207 |
* @param client Index of the client. |
|
ds@1952
|
208 |
* @param error Error buffer for a disconnect reason. |
|
ds@1952
|
209 |
* @param maxlength Maximum length of error buffer. |
|
ds@1952
|
210 |
* @return True to allow client, false to reject. |
|
ds@1952
|
211 |
*/ |
|
ds@1952
|
212 |
virtual bool InterceptClientConnect(int client, char *error, size_t maxlength) |
|
ds@1952
|
213 |
{ |
|
ds@1952
|
214 |
return true; |
|
ds@1952
|
215 |
} |
|
ds@1952
|
216 |
|
|
ds@1952
|
217 |
/** |
|
ds@1952
|
218 |
* @brief Called when a client has connected. |
|
ds@1952
|
219 |
* |
|
ds@1952
|
220 |
* @param client Index of the client. |
|
ds@1952
|
221 |
*/ |
|
ds@1952
|
222 |
virtual void OnClientConnected(int client) |
|
ds@1952
|
223 |
{ |
|
ds@1952
|
224 |
} |
|
ds@1952
|
225 |
|
|
ds@1952
|
226 |
/** |
|
ds@1952
|
227 |
* @brief Called when a client is put in server. |
|
ds@1952
|
228 |
* |
|
ds@1952
|
229 |
* @param client Index of the client. |
|
ds@1952
|
230 |
*/ |
|
ds@1952
|
231 |
virtual void OnClientPutInServer(int client) |
|
ds@1952
|
232 |
{ |
|
ds@1952
|
233 |
} |
|
ds@1952
|
234 |
|
|
ds@1952
|
235 |
/** |
|
ds@1952
|
236 |
* @brief Called when a client is disconnecting (not fully disconnected yet). |
|
ds@1952
|
237 |
* |
|
ds@1952
|
238 |
* @param client Index of the client. |
|
ds@1952
|
239 |
*/ |
|
ds@1952
|
240 |
virtual void OnClientDisconnecting(int client) |
|
ds@1952
|
241 |
{ |
|
ds@1952
|
242 |
} |
|
ds@1952
|
243 |
|
|
ds@1952
|
244 |
/** |
|
ds@1952
|
245 |
* @brief Called when a client has fully disconnected. |
|
ds@1952
|
246 |
* |
|
ds@1952
|
247 |
* @param client Index of the client. |
|
ds@1952
|
248 |
*/ |
|
ds@1952
|
249 |
virtual void OnClientDisconnected(int client) |
|
ds@1952
|
250 |
{ |
|
ds@1952
|
251 |
} |
|
ds@1952
|
252 |
|
|
ds@1952
|
253 |
/** |
|
ds@1952
|
254 |
* @brief Called when a client has received authorization. |
|
ds@1952
|
255 |
* |
|
ds@1952
|
256 |
* @param client Index of the client. |
|
ds@1952
|
257 |
* @param authstring Authorization string. |
|
ds@1952
|
258 |
*/ |
|
ds@1952
|
259 |
virtual void OnClientAuthorized(int client, const char *authstring) |
|
ds@1952
|
260 |
{ |
|
ds@1952
|
261 |
} |
|
ds@1952
|
262 |
|
|
ds@1952
|
263 |
/** |
|
ds@1952
|
264 |
* @brief Called when the server is activated. |
|
ds@1952
|
265 |
*/ |
|
ds@1952
|
266 |
virtual void OnServerActivated(int max_clients) |
|
ds@1952
|
267 |
{ |
|
ds@1952
|
268 |
} |
|
ds@1952
|
269 |
|
|
ds@1952
|
270 |
/** |
|
ds@1952
|
271 |
* @brief Called once a client is authorized and fully in-game, but |
|
ds@1952
|
272 |
* before admin checks are done. This can be used to override the |
|
ds@1952
|
273 |
* default admin checks for a client. |
|
ds@1952
|
274 |
* |
|
ds@1952
|
275 |
* By default, this function allows the authentication process to |
|
ds@1952
|
276 |
* continue as normal. If you need to delay the cache searching |
|
ds@1952
|
277 |
* process in order to get asynchronous data, then return false here. |
|
ds@1952
|
278 |
* |
|
ds@1952
|
279 |
* If you return false, you must call IPlayerManager::NotifyPostAdminCheck |
|
ds@1952
|
280 |
* for the same client, or else the OnClientPostAdminCheck callback will |
|
ds@1952
|
281 |
* never be called. |
|
ds@1952
|
282 |
* |
|
ds@1952
|
283 |
* @param client Client index. |
|
ds@1952
|
284 |
* @return True to continue normally, false to override |
|
ds@1952
|
285 |
* the authentication process. |
|
ds@1952
|
286 |
*/ |
|
ds@1952
|
287 |
virtual bool OnClientPreAdminCheck(int client) |
|
ds@1952
|
288 |
{ |
|
ds@1952
|
289 |
return true; |
|
ds@1952
|
290 |
} |
|
ds@1952
|
291 |
|
|
ds@1952
|
292 |
/** |
|
ds@1952
|
293 |
* @brief Called once a client is authorized and fully in-game, and |
|
ds@1952
|
294 |
* after all post-connection authorizations have been passed. If the |
|
ds@1952
|
295 |
* client does not have an AdminId by this stage, it means that no |
|
ds@1952
|
296 |
* admin entry was in the cache that matched, and the user could not |
|
ds@1952
|
297 |
* be authenticated as an admin. |
|
ds@1952
|
298 |
* |
|
ds@1952
|
299 |
* @param client Client index. |
|
ds@1952
|
300 |
*/ |
|
ds@1952
|
301 |
virtual void OnClientPostAdminCheck(int client) |
|
ds@1952
|
302 |
{ |
|
ds@1952
|
303 |
} |
|
ds@1952
|
304 |
}; |
|
ds@1952
|
305 |
|
|
ds@1952
|
306 |
#define COMMAND_FILTER_ALIVE (1<<0) /**< Only allow alive players */ |
|
ds@1952
|
307 |
#define COMMAND_FILTER_DEAD (1<<1) /**< Only filter dead players */ |
|
ds@1952
|
308 |
#define COMMAND_FILTER_CONNECTED (1<<2) /**< Allow players not fully in-game */ |
|
ds@1952
|
309 |
#define COMMAND_FILTER_NO_IMMUNITY (1<<3) /**< Ignore immunity rules */ |
|
ds@1952
|
310 |
#define COMMAND_FILTER_NO_MULTI (1<<4) /**< Do not allow multiple target patterns */ |
|
ds@1952
|
311 |
#define COMMAND_FILTER_NO_BOTS (1<<5) /**< Do not allow bots to be targetted */ |
|
ds@1952
|
312 |
|
|
ds@1952
|
313 |
#define COMMAND_TARGET_VALID 1 /**< Client passed the filter */ |
|
ds@1952
|
314 |
#define COMMAND_TARGET_NONE 0 /**< No target was found */ |
|
ds@1952
|
315 |
#define COMMAND_TARGET_NOT_ALIVE -1 /**< Single client is not alive */ |
|
ds@1952
|
316 |
#define COMMAND_TARGET_NOT_DEAD -2 /**< Single client is not dead */ |
|
ds@1952
|
317 |
#define COMMAND_TARGET_NOT_IN_GAME -3 /**< Single client is not in game */ |
|
ds@1952
|
318 |
#define COMMAND_TARGET_IMMUNE -4 /**< Single client is immune */ |
|
ds@1952
|
319 |
#define COMMAND_TARGET_EMPTY_FILTER -5 /**< A multi-filter (such as @all) had no targets */ |
|
ds@1952
|
320 |
#define COMMAND_TARGET_NOT_HUMAN -6 /**< Target was not human */ |
|
ds@1952
|
321 |
#define COMMAND_TARGET_AMBIGUOUS -7 /**< Partial name had too many targets */ |
|
ds@1952
|
322 |
|
|
ds@1952
|
323 |
#define COMMAND_TARGETNAME_RAW 0 /**< Target name is a raw string */ |
|
ds@1952
|
324 |
#define COMMAND_TARGETNAME_ML 1 /**< Target name is a multi-lingual phrase */ |
|
ds@1952
|
325 |
|
|
ds@1952
|
326 |
/** |
|
ds@1952
|
327 |
* @brief Holds the many command target info parameters. |
|
ds@1952
|
328 |
*/ |
|
ds@1952
|
329 |
struct cmd_target_info_t |
|
ds@1952
|
330 |
{ |
|
ds@1952
|
331 |
const char *pattern; /**< IN: Target pattern string. */ |
|
ds@1952
|
332 |
int admin; /**< IN: Client admin index, or 0 if server .*/ |
|
ds@1952
|
333 |
cell_t *targets; /**< IN: Array to store targets. */ |
|
ds@1952
|
334 |
cell_t max_targets; /**< IN: Max targets (always >= 1) */ |
|
ds@1952
|
335 |
int flags; /**< IN: COMMAND_FILTER flags. */ |
|
ds@1952
|
336 |
char *target_name; /**< OUT: Buffer to store target name. */ |
|
ds@1952
|
337 |
size_t target_name_maxlength; /**< IN: Maximum length of the target name buffer. */ |
|
ds@1952
|
338 |
int target_name_style; /**< OUT: Target name style (COMMAND_TARGETNAME) */ |
|
ds@1952
|
339 |
int reason; /**< OUT: COMMAND_TARGET reason. */ |
|
ds@1952
|
340 |
unsigned int num_targets; /**< OUT: Number of targets. */ |
|
ds@1952
|
341 |
}; |
|
ds@1952
|
342 |
|
|
ds@1952
|
343 |
/** |
|
ds@1952
|
344 |
* @brief Intercepts a command target operation. |
|
ds@1952
|
345 |
*/ |
|
ds@1952
|
346 |
class ICommandTargetProcessor |
|
ds@1952
|
347 |
{ |
|
ds@1952
|
348 |
public: |
|
ds@1952
|
349 |
/** |
|
ds@1952
|
350 |
* @brief Must process the command target and return a COMMAND_TARGET value. |
|
ds@1952
|
351 |
* |
|
ds@1952
|
352 |
* @param info Struct containing command target information. |
|
ds@1952
|
353 |
* Any members labelled OUT must be filled if processing |
|
ds@1952
|
354 |
* is to be completed (i.e. true returned). |
|
ds@1952
|
355 |
* @return True to end processing, false to let Core continue. |
|
ds@1952
|
356 |
*/ |
|
ds@1952
|
357 |
virtual bool ProcessCommandTarget(cmd_target_info_t *info) =0; |
|
ds@1952
|
358 |
}; |
|
ds@1952
|
359 |
|
|
ds@1952
|
360 |
class IPlayerManager : public SMInterface |
|
ds@1952
|
361 |
{ |
|
ds@1952
|
362 |
public: |
|
ds@1952
|
363 |
const char *GetInterfaceName() |
|
ds@1952
|
364 |
{ |
|
ds@1952
|
365 |
return SMINTERFACE_PLAYERMANAGER_NAME; |
|
ds@1952
|
366 |
} |
|
ds@1952
|
367 |
unsigned int GetInterfaceVersion() |
|
ds@1952
|
368 |
{ |
|
ds@1952
|
369 |
return SMINTERFACE_PLAYERMANAGER_VERSION; |
|
ds@1952
|
370 |
} |
|
ds@1952
|
371 |
public: |
|
ds@1952
|
372 |
/** |
|
ds@1952
|
373 |
* @brief Adds a client listener. |
|
ds@1952
|
374 |
* |
|
ds@1952
|
375 |
* @param listener Pointer to an IClientListener. |
|
ds@1952
|
376 |
*/ |
|
ds@1952
|
377 |
virtual void AddClientListener(IClientListener *listener) =0; |
|
ds@1952
|
378 |
|
|
ds@1952
|
379 |
/** |
|
ds@1952
|
380 |
* @brief Removes a client listener. |
|
ds@1952
|
381 |
* |
|
ds@1952
|
382 |
* @param listener Pointer to an IClientListener. |
|
ds@1952
|
383 |
*/ |
|
ds@1952
|
384 |
virtual void RemoveClientListener(IClientListener *listener) =0; |
|
ds@1952
|
385 |
|
|
ds@1952
|
386 |
/** |
|
ds@1952
|
387 |
* @brief Retrieves an IGamePlayer object by its client index. |
|
ds@1952
|
388 |
* |
|
ds@1952
|
389 |
* Note: This will return a valid object for any player, connected or not. |
|
ds@1952
|
390 |
* Note: Client indexes start at 1, not 0. |
|
ds@1952
|
391 |
* |
|
ds@1952
|
392 |
* @param client Index of the client. |
|
ds@1952
|
393 |
* @return An IGamePlayer pointer, or NULL if out of range. |
|
ds@1952
|
394 |
*/ |
|
ds@1952
|
395 |
virtual IGamePlayer *GetGamePlayer(int client) =0; |
|
ds@1952
|
396 |
|
|
ds@1952
|
397 |
/** |
|
ds@1952
|
398 |
* @brief Retrieves an IGamePlayer object by its edict_t pointer. |
|
ds@1952
|
399 |
* |
|
ds@1952
|
400 |
* @param pEdict Index of the client |
|
ds@1952
|
401 |
* @return An IGamePlayer pointer, or NULL if out of range. |
|
ds@1952
|
402 |
*/ |
|
ds@1952
|
403 |
virtual IGamePlayer *GetGamePlayer(edict_t *pEdict) =0; |
|
ds@1952
|
404 |
|
|
ds@1952
|
405 |
/** |
|
ds@1952
|
406 |
* @brief Returns the maximum number of clients. |
|
ds@1952
|
407 |
* |
|
ds@1952
|
408 |
* Note: this will not work until the server is activated. |
|
ds@1952
|
409 |
* |
|
ds@1952
|
410 |
* @return Maximum number of clients. |
|
ds@1952
|
411 |
*/ |
|
ds@1952
|
412 |
virtual int GetMaxClients() =0; |
|
ds@1952
|
413 |
|
|
ds@1952
|
414 |
/** |
|
ds@1952
|
415 |
* @brief Returns the number of players currently connected. |
|
ds@1952
|
416 |
* |
|
ds@1952
|
417 |
* @return Current number of connected clients. |
|
ds@1952
|
418 |
*/ |
|
ds@1952
|
419 |
virtual int GetNumPlayers() =0; |
|
ds@1952
|
420 |
|
|
ds@1952
|
421 |
/** |
|
ds@1952
|
422 |
* @brief Returns the client index by its userid. |
|
ds@1952
|
423 |
* |
|
ds@1952
|
424 |
* @param userid Userid of the client. |
|
ds@1952
|
425 |
* @return Client index, or 0 if invalid userid passed. |
|
ds@1952
|
426 |
*/ |
|
ds@1952
|
427 |
virtual int GetClientOfUserId(int userid) =0; |
|
ds@1952
|
428 |
|
|
ds@1952
|
429 |
/** |
|
ds@1952
|
430 |
* @brief Returns whether or not the server is activated. |
|
ds@1952
|
431 |
* |
|
ds@1952
|
432 |
* @return True if ServerActivate() has been called |
|
ds@1952
|
433 |
* at least once, false otherwise. |
|
ds@1952
|
434 |
*/ |
|
ds@1952
|
435 |
virtual bool IsServerActivated() =0; |
|
ds@1952
|
436 |
|
|
ds@1952
|
437 |
/** |
|
ds@1952
|
438 |
* @brief Gets SourceMod's reply source. |
|
ds@1952
|
439 |
* |
|
ds@1952
|
440 |
* @return ReplyTo source. |
|
ds@1952
|
441 |
*/ |
|
ds@1952
|
442 |
virtual unsigned int GetReplyTo() =0; |
|
ds@1952
|
443 |
|
|
ds@1952
|
444 |
/** |
|
ds@1952
|
445 |
* @brief Sets SourceMod's reply source. |
|
ds@1952
|
446 |
* |
|
ds@1952
|
447 |
* @param reply Reply source. |
|
ds@1952
|
448 |
* @return Old reply source. |
|
ds@1952
|
449 |
*/ |
|
ds@1952
|
450 |
virtual unsigned int SetReplyTo(unsigned int reply) =0; |
|
ds@1952
|
451 |
|
|
ds@1952
|
452 |
/** |
|
ds@1952
|
453 |
* @brief Tests if a player meets command filtering rules. |
|
ds@1952
|
454 |
* |
|
ds@1952
|
455 |
* @param pAdmin IGamePlayer of the admin, or NULL if the server. |
|
ds@1952
|
456 |
* @param pTarget IGamePlayer of the player being targeted. |
|
ds@1952
|
457 |
* @param flags COMMAND_FILTER flags. |
|
ds@1952
|
458 |
* @return COMMAND_TARGET value. |
|
ds@1952
|
459 |
*/ |
|
ds@1952
|
460 |
virtual int FilterCommandTarget(IGamePlayer *pAdmin, IGamePlayer *pTarget, int flags) =0; |
|
ds@1952
|
461 |
|
|
ds@1952
|
462 |
/** |
|
ds@1952
|
463 |
* @brief Registers a command target processor. |
|
ds@1952
|
464 |
* |
|
ds@1952
|
465 |
* @param pHandler Pointer to an ICommandTargetProcessor instance. |
|
ds@1952
|
466 |
*/ |
|
ds@1952
|
467 |
virtual void RegisterCommandTargetProcessor(ICommandTargetProcessor *pHandler) =0; |
|
ds@1952
|
468 |
|
|
ds@1952
|
469 |
/** |
|
ds@1952
|
470 |
* @brief Removes a command target processor. |
|
ds@1952
|
471 |
* |
|
ds@1952
|
472 |
* @param pHandler Pointer to an ICommandTargetProcessor instance. |
|
ds@1952
|
473 |
*/ |
|
ds@1952
|
474 |
virtual void UnregisterCommandTargetProcessor(ICommandTargetProcessor *pHandler) =0; |
|
ds@1952
|
475 |
}; |
|
ds@1952
|
476 |
} |
|
ds@1952
|
477 |
|
|
ds@1952
|
478 |
#endif //_INCLUDE_SOURCEMOD_INTERFACE_IPLAYERHELPERS_H_ |