Added GetMaxHumanPlayers native exposing IServerGameClients func (bug 5551, r=asherkin).
Added GetMaxHumanPlayers native exposing IServerGameClients func (
bug 5551, r=asherkin).
1.1 --- a/core/smn_player.cpp Sat Dec 01 13:41:00 2012 -0500
1.2 +++ b/core/smn_player.cpp Sun Dec 02 11:03:27 2012 -0500
1.3 @@ -66,6 +66,22 @@
1.4 return g_Players.MaxClients();
1.5 }
1.6
1.7 +static cell_t sm_GetMaxHumanPlayers(IPluginContext *pCtx, const cell_t *params)
1.8 +{
1.9 + int maxHumans = -1;
1.10 +
1.11 +#if SOURCE_ENGINE >= SE_LEFT4DEAD
1.12 + maxHumans = serverClients->GetMaxHumanPlayers();
1.13 +#endif
1.14 +
1.15 + if( maxHumans == -1 )
1.16 + {
1.17 + return g_Players.MaxClients();
1.18 + }
1.19 +
1.20 + return maxHumans;
1.21 +}
1.22 +
1.23 static cell_t sm_GetClientName(IPluginContext *pCtx, const cell_t *params)
1.24 {
1.25 int index = params[1];
1.26 @@ -1634,6 +1650,7 @@
1.27 {"GetClientTeam", GetClientTeam},
1.28 {"GetClientUserId", GetClientUserId},
1.29 {"GetMaxClients", sm_GetMaxClients},
1.30 + {"GetMaxHumanPlayers", sm_GetMaxHumanPlayers},
1.31 {"GetUserAdmin", GetUserAdmin},
1.32 {"GetUserFlagBits", GetUserFlagBits},
1.33 {"IsClientAuthorized", sm_IsClientAuthorized},
2.1 --- a/plugins/include/clients.inc Sat Dec 01 13:41:00 2012 -0500
2.2 +++ b/plugins/include/clients.inc Sun Dec 02 11:03:27 2012 -0500
2.3 @@ -210,6 +210,21 @@
2.4 native GetMaxClients();
2.5
2.6 /**
2.7 + * Returns the maximum number of human players allowed on the server. This is
2.8 + * a game-specific function used on newer games to limit the number of humans
2.9 + * that can join a game and can be lower than MaxClients. It is the number often
2.10 + * reflected in the server browser or when viewing the output of the status command.
2.11 + * On unsupported games or modes without overrides, it will return the same value
2.12 + * as MaxClients.
2.13 + *
2.14 + * You should not globally cache the value to GetMaxHumanPlayers() because it can change across
2.15 + * game modes. You may still cache it locally.
2.16 + *
2.17 + * @return Maximum number of humans allowed.
2.18 + */
2.19 +native GetMaxHumanPlayers();
2.20 +
2.21 +/**
2.22 * Returns the client count put in the server.
2.23 *
2.24 * @param inGameOnly If false connecting players are also counted.