mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Add 'GetNumClients'
Gets the total amount of clients on the server (both fake and real clients).
This commit is contained in:
parent
b1f2f47058
commit
decf3552ea
@ -57,6 +57,26 @@ int CServer::GetNumFakeClients(void) const
|
||||
return nBots;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: Gets the number of clients on the server
|
||||
// Output : int
|
||||
//---------------------------------------------------------------------------------
|
||||
int CServer::GetNumClients(void) const
|
||||
{
|
||||
int nClients = 0;
|
||||
for (int i = 0; i < g_ServerGlobalVariables->m_nMaxClients; i++)
|
||||
{
|
||||
CClient* pClient = g_pClient->GetClient(i);
|
||||
if (!pClient)
|
||||
continue;
|
||||
|
||||
if (pClient->IsConnected())
|
||||
nClients++;
|
||||
}
|
||||
|
||||
return nClients;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: client to server authentication
|
||||
// Input : *pChallenge -
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
#ifndef CLIENT_DLL // Only the connectionless packet handler is implemented on the client via the IServer base class.
|
||||
int GetNumHumanPlayers(void) const;
|
||||
int GetNumFakeClients(void) const;
|
||||
int GetNumClients(void) const;
|
||||
const char* GetMapName(void) const { return m_szMapname; }
|
||||
const char* GetMapGroupName(void) const { return m_szMapGroupName; }
|
||||
int GetNumClasses(void) const { return m_nServerClasses; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user