Solved How to get Max Players Count Sourcemod Stock?

Vertigo

⍥????
Staff member
Administrator
To get the total number of clients put in the server.

clients.inc -
GetClientCount()
C++:
int GetClientCount(bool inGameOnly)

// Example
int playersCount = GetClientCount(true); // Will return the total number of players actually put in the server
int playersCount = GetClientCount(false); // Will return the total number of players put in the server including the connecting clients

To get the total number of players server supports (maxplayers)

C++:
int maxPlayers = MaxClients;
// Where MaxClients is a const defined in sourcemod which represents total number of slots the server supports (dynamic)

To get the total number of players server supports (Deprecated Native)

clients.inc -
GetMaxClients()
C++:
/**
* Returns the maximum number of clients allowed on the server.  This may
* return 0 if called before OnMapStart(), and thus should not be called
* in OnPluginStart().
*
* @return    Maximum number of clients allowed.
*/
native GetMaxClients();

// Example
int maxPlayers = GetMaxClients();
 
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock