2 * ===============================================================
3 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
4 * ===============================================================
6 * This file is not open source and may not be copied without explicit
7 * written permission of AlliedModders LLC. This file may not be redistributed
8 * in whole or significant part.
9 * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
14 #ifndef _INCLUDE_SOURCEMOD_CPLAYERMANAGER_H_
15 #define _INCLUDE_SOURCEMOD_CPLAYERMANAGER_H_
17 #include "sm_globals.h"
19 #include "sourcemm_api.h"
20 #include <IForwardSys.h>
25 class CPlayerManager : public SMGlobalClass
28 CPlayerManager() : m_FirstPass(true) {}
29 public: //SMGlobalClass
30 virtual void OnSourceModAllInitialized();
31 virtual void OnSourceModShutdown();
33 int GetMaxClients() const;
34 CPlayer *GetPlayerByIndex(int client) const;
35 int GetPlayerCount() const;
37 bool OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
38 void OnClientPutInServer(edict_t *pEntity, char const *playername);
39 void OnClientDisconnect(edict_t *pEntity);
40 void OnClientDisconnect_Post(edict_t *pEntity);
41 void OnClientAuthorized(); //:TODO: any args needed?
42 void OnClientCommand(edict_t *pEntity);
43 void OnClientSettingsChanged(edict_t *pEntity);
45 void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
47 IForward *m_clconnect;
48 IForward *m_cldisconnect;
49 IForward *m_cldisconnect_post;
50 IForward *m_clputinserver;
51 IForward *m_clcommand;
52 IForward *m_clinfochanged;
59 extern CPlayerManager g_PlayerManager;
61 inline int CPlayerManager::GetMaxClients() const
66 inline CPlayer *CPlayerManager::GetPlayerByIndex(int client) const
68 if (client > m_maxClients || client < 0)
72 return &m_Players[client];
75 inline int CPlayerManager::GetPlayerCount() const
80 #endif //_INCLUDE_SOURCEMOD_CPLAYERMANAGER_H_