SourceMod SDK  1.7
IPlayerHelpers.h
Go to the documentation of this file.
1 
32 #ifndef _INCLUDE_SOURCEMOD_INTERFACE_IPLAYERHELPERS_H_
33 #define _INCLUDE_SOURCEMOD_INTERFACE_IPLAYERHELPERS_H_
34 
40 #include <IShareSys.h>
41 #include <IAdminSystem.h>
42 
43 #define SMINTERFACE_PLAYERMANAGER_NAME "IPlayerManager"
44 #define SMINTERFACE_PLAYERMANAGER_VERSION 21
45 
46 struct edict_t;
47 class IPlayerInfo;
48 
49 #define SM_REPLY_CONSOLE 0
50 #define SM_REPLY_CHAT 1
52 #define SM_MAXPLAYERS 65
54 namespace SourceMod
55 {
60  {
61  public:
68  virtual const char *GetName() =0;
69 
76  virtual const char *GetIPAddress() =0;
77 
85  virtual const char *GetAuthString(bool validated = true) =0;
86 
92  virtual edict_t *GetEdict() =0;
93 
99  virtual bool IsInGame() =0;
100 
109  virtual bool IsConnected() =0;
110 
116  virtual bool IsFakeClient() =0;
117 
123  virtual AdminId GetAdminId() =0;
124 
131  virtual void SetAdminId(AdminId id, bool temp) =0;
132 
138  virtual int GetUserId() =0;
139 
145  virtual unsigned int GetLanguageId() =0;
146 
152  virtual IPlayerInfo *GetPlayerInfo() =0;
153 
165  virtual bool RunAdminCacheChecks() =0;
166 
188  virtual void NotifyPostAdminChecks() =0;
189 
195  virtual unsigned int GetSerial() =0;
196 
202  virtual bool IsAuthorized() =0;
203 
209  virtual void Kick(const char *message) =0;
210 
218  virtual bool IsInKickQueue() =0;
219 
225  virtual void MarkAsBeingKicked() =0;
226 
227  virtual void SetLanguageId(unsigned int id) =0;
228 
234  virtual bool IsSourceTV() const =0;
235 
241  virtual bool IsReplay() const =0;
242 
250  virtual unsigned int GetSteamAccountID(bool validated = true) =0;
251 
257  virtual int GetIndex() const =0;
258 
264  virtual void PrintToConsole(const char *pMsg) =0;
265 
269  virtual void ClearAdmin() =0;
270 
278  virtual uint64_t GetSteamId64(bool validated = true) =0;
279 
287  virtual const char *GetSteam2Id(bool validated = true) =0;
288 
296  virtual const char *GetSteam3Id(bool validated = true) =0;
297  };
298 
303  {
304  public:
310  virtual unsigned int GetClientListenerVersion()
311  {
312  return SMINTERFACE_PLAYERMANAGER_VERSION;
313  }
314  public:
323  virtual bool InterceptClientConnect(int client, char *error, size_t maxlength)
324  {
325  return true;
326  }
327 
333  virtual void OnClientConnected(int client)
334  {
335  }
336 
342  virtual void OnClientPutInServer(int client)
343  {
344  }
345 
351  virtual void OnClientDisconnecting(int client)
352  {
353  }
354 
360  virtual void OnClientDisconnected(int client)
361  {
362  }
363 
370  virtual void OnClientAuthorized(int client, const char *authstring)
371  {
372  }
373 
377  virtual void OnServerActivated(int max_clients)
378  {
379  }
380 
398  virtual bool OnClientPreAdminCheck(int client)
399  {
400  return true;
401  }
402 
412  virtual void OnClientPostAdminCheck(int client)
413  {
414  }
415 
421  virtual void OnMaxPlayersChanged(int newvalue)
422  {
423  }
424 
430  virtual void OnClientSettingsChanged(int client)
431  {
432  }
433  };
434 
435  #define COMMAND_FILTER_ALIVE (1<<0)
436  #define COMMAND_FILTER_DEAD (1<<1)
437  #define COMMAND_FILTER_CONNECTED (1<<2)
438  #define COMMAND_FILTER_NO_IMMUNITY (1<<3)
439  #define COMMAND_FILTER_NO_MULTI (1<<4)
440  #define COMMAND_FILTER_NO_BOTS (1<<5)
442  #define COMMAND_TARGET_VALID 1
443  #define COMMAND_TARGET_NONE 0
444  #define COMMAND_TARGET_NOT_ALIVE -1
445  #define COMMAND_TARGET_NOT_DEAD -2
446  #define COMMAND_TARGET_NOT_IN_GAME -3
447  #define COMMAND_TARGET_IMMUNE -4
448  #define COMMAND_TARGET_EMPTY_FILTER -5
449  #define COMMAND_TARGET_NOT_HUMAN -6
450  #define COMMAND_TARGET_AMBIGUOUS -7
452  #define COMMAND_TARGETNAME_RAW 0
453  #define COMMAND_TARGETNAME_ML 1
458  struct cmd_target_info_t
459  {
460  const char *pattern;
461  int admin;
462  cell_t *targets;
463  cell_t max_targets;
464  int flags;
465  char *target_name;
468  int reason;
469  unsigned int num_targets;
470  };
471 
476  {
477  public:
486  virtual bool ProcessCommandTarget(cmd_target_info_t *info) =0;
487  };
488 
490  {
491  public:
492  const char *GetInterfaceName()
493  {
494  return SMINTERFACE_PLAYERMANAGER_NAME;
495  }
496  unsigned int GetInterfaceVersion()
497  {
498  return SMINTERFACE_PLAYERMANAGER_VERSION;
499  }
500  public:
506  virtual void AddClientListener(IClientListener *listener) =0;
507 
513  virtual void RemoveClientListener(IClientListener *listener) =0;
514 
524  virtual IGamePlayer *GetGamePlayer(int client) =0;
525 
532  virtual IGamePlayer *GetGamePlayer(edict_t *pEdict) =0;
533 
541  virtual int GetMaxClients() =0;
542 
548  virtual int GetNumPlayers() =0;
549 
556  virtual int GetClientOfUserId(int userid) =0;
557 
564  virtual bool IsServerActivated() =0;
565 
571  virtual unsigned int GetReplyTo() =0;
572 
579  virtual unsigned int SetReplyTo(unsigned int reply) =0;
580 
589  virtual int FilterCommandTarget(IGamePlayer *pAdmin, IGamePlayer *pTarget, int flags) =0;
590 
596  virtual void RegisterCommandTargetProcessor(ICommandTargetProcessor *pHandler) =0;
597 
603  virtual void UnregisterCommandTargetProcessor(ICommandTargetProcessor *pHandler) =0;
604 
610  virtual int GetClientFromSerial(unsigned int serial) =0;
611 
618  virtual void ProcessCommandTarget(cmd_target_info_t *info) =0;
619 
625  virtual void ClearAdminId(AdminId id) =0;
626 
630  virtual void RecheckAnyAdmins() =0;
631  };
632 }
633 
634 #endif //_INCLUDE_SOURCEMOD_INTERFACE_IPLAYERHELPERS_H_
int target_name_style
Definition: IPlayerHelpers.h:467
char * target_name
Definition: IPlayerHelpers.h:465
Defines the Share System, responsible for shared resources and dependencies.
virtual void OnClientDisconnecting(int client)
Called when a client is disconnecting (not fully disconnected yet).
Definition: IPlayerHelpers.h:351
int reason
Definition: IPlayerHelpers.h:468
virtual void OnClientConnected(int client)
Called when a client has connected.
Definition: IPlayerHelpers.h:333
Definition: IPlayerHelpers.h:489
Defines the base functionality required by a shared interface.
Definition: IShareSys.h:92
cell_t * targets
Definition: IPlayerHelpers.h:462
cell_t max_targets
Definition: IPlayerHelpers.h:463
virtual bool InterceptClientConnect(int client, char *error, size_t maxlength)
Called when a client requests connection.
Definition: IPlayerHelpers.h:323
size_t target_name_maxlength
Definition: IPlayerHelpers.h:466
Provides callbacks for important client events.
Definition: IPlayerHelpers.h:302
int admin
Definition: IPlayerHelpers.h:461
virtual unsigned int GetClientListenerVersion()
Returns the current client listener version.
Definition: IPlayerHelpers.h:310
unsigned int GetInterfaceVersion()
Must return an integer defining the interface's version.
Definition: IPlayerHelpers.h:496
Holds the many command target info parameters.
Definition: IPlayerHelpers.h:458
virtual void OnClientDisconnected(int client)
Called when a client has fully disconnected.
Definition: IPlayerHelpers.h:360
int flags
Definition: IPlayerHelpers.h:464
Intercepts a command target operation.
Definition: IPlayerHelpers.h:475
const char * pattern
Definition: IPlayerHelpers.h:460
Abstracts some Half-Life 2 and SourceMod properties about clients.
Definition: IPlayerHelpers.h:59
Defines the interface to manage the Admin Users/Groups and Override caches.
virtual bool OnClientPreAdminCheck(int client)
Called once a client is authorized and fully in-game, but before admin checks are done...
Definition: IPlayerHelpers.h:398
virtual void OnClientPutInServer(int client)
Called when a client is put in server.
Definition: IPlayerHelpers.h:342
virtual void OnClientSettingsChanged(int client)
Notifies the extension that a clients settings changed.
Definition: IPlayerHelpers.h:430
virtual void OnServerActivated(int max_clients)
Called when the server is activated.
Definition: IPlayerHelpers.h:377
unsigned int num_targets
Definition: IPlayerHelpers.h:469
virtual void OnClientAuthorized(int client, const char *authstring)
Called when a client has received authorization.
Definition: IPlayerHelpers.h:370
virtual void OnMaxPlayersChanged(int newvalue)
Notifies the extension that the maxplayers value has changed.
Definition: IPlayerHelpers.h:421
virtual void OnClientPostAdminCheck(int client)
Called once a client is authorized and fully in-game, and after all post-connection authorizations ha...
Definition: IPlayerHelpers.h:412
const char * GetInterfaceName()
Must return a string defining the interface's unique name.
Definition: IPlayerHelpers.h:492