2006-12-28 01:48:09 +01:00
|
|
|
#ifndef _INCLUDE_SOURCEMOD_CPLAYERMANAGER_H_
|
|
|
|
#define _INCLUDE_SOURCEMOD_CPLAYERMANAGER_H_
|
|
|
|
|
2007-01-01 04:33:14 +01:00
|
|
|
#include "sm_globals.h"
|
2006-12-28 01:48:09 +01:00
|
|
|
#include <eiface.h>
|
|
|
|
#include "sourcemm_api.h"
|
|
|
|
#include <IForwardSys.h>
|
2007-01-01 04:33:14 +01:00
|
|
|
#include "CPlayer.h"
|
|
|
|
|
|
|
|
class CPlayer;
|
2006-12-28 01:48:09 +01:00
|
|
|
|
|
|
|
class CPlayerManager : public SMGlobalClass
|
|
|
|
{
|
2007-01-05 01:58:28 +01:00
|
|
|
public:
|
|
|
|
CPlayerManager() : m_FirstPass(true) {}
|
2006-12-28 01:48:09 +01:00
|
|
|
public: //SMGlobalClass
|
|
|
|
virtual void OnSourceModAllInitialized();
|
|
|
|
virtual void OnSourceModShutdown();
|
2007-01-01 04:33:14 +01:00
|
|
|
public:
|
|
|
|
int GetMaxClients() const;
|
|
|
|
CPlayer *GetPlayerByIndex(int client) const;
|
|
|
|
int GetPlayerCount() const;
|
2006-12-28 01:48:09 +01:00
|
|
|
public:
|
|
|
|
bool OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
|
|
|
|
void OnClientPutInServer(edict_t *pEntity, char const *playername);
|
|
|
|
void OnClientDisconnect(edict_t *pEntity);
|
|
|
|
void OnClientDisconnect_Post(edict_t *pEntity);
|
|
|
|
void OnClientAuthorized(); //:TODO: any args needed?
|
|
|
|
void OnClientCommand(edict_t *pEntity);
|
2007-01-01 04:33:14 +01:00
|
|
|
void OnClientSettingsChanged(edict_t *pEntity);
|
2007-01-05 01:42:22 +01:00
|
|
|
private:
|
|
|
|
void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
|
2006-12-28 01:48:09 +01:00
|
|
|
private:
|
|
|
|
IForward *m_clconnect;
|
|
|
|
IForward *m_cldisconnect;
|
|
|
|
IForward *m_cldisconnect_post;
|
|
|
|
IForward *m_clputinserver;
|
|
|
|
IForward *m_clcommand;
|
2007-01-01 04:33:14 +01:00
|
|
|
IForward *m_clinfochanged;
|
|
|
|
CPlayer *m_Players;
|
|
|
|
int m_maxClients;
|
|
|
|
int m_PlayerCount;
|
2007-01-05 01:58:28 +01:00
|
|
|
bool m_FirstPass;
|
2006-12-28 01:48:09 +01:00
|
|
|
};
|
|
|
|
|
2007-01-01 04:33:14 +01:00
|
|
|
extern CPlayerManager g_PlayerManager;
|
|
|
|
|
|
|
|
inline int CPlayerManager::GetMaxClients() const
|
|
|
|
{
|
|
|
|
return m_maxClients;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline CPlayer *CPlayerManager::GetPlayerByIndex(int client) const
|
|
|
|
{
|
|
|
|
if (client > m_maxClients || client < 0)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return &m_Players[client];
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int CPlayerManager::GetPlayerCount() const
|
|
|
|
{
|
|
|
|
return m_PlayerCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //_INCLUDE_SOURCEMOD_CPLAYERMANAGER_H_
|