Added MaxClients public var to replace GetMaxClients (bug 3283, r=pred).
This is a hard bump of the plugin version number. 1.1 plugins compiled against this include set will not run against earlier versions of SourceMod.
This commit is contained in:
+6
-14
@@ -237,8 +237,7 @@ public Action:Command_SmHsay(client, args)
|
||||
|
||||
decl String:nameBuf[MAX_NAME_LENGTH];
|
||||
|
||||
new maxClients = GetMaxClients();
|
||||
for (new i = 1; i <= maxClients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (!IsClientConnected(i) || IsFakeClient(i))
|
||||
{
|
||||
@@ -270,7 +269,6 @@ public Action:Command_SmTsay(client, args)
|
||||
GetClientName(client, name, sizeof(name));
|
||||
|
||||
new color = FindColor(colorStr);
|
||||
new maxClients = GetMaxClients();
|
||||
new String:nameBuf[MAX_NAME_LENGTH];
|
||||
|
||||
if (color == -1)
|
||||
@@ -279,7 +277,7 @@ public Action:Command_SmTsay(client, args)
|
||||
len = 0;
|
||||
}
|
||||
|
||||
for (new i = 1; i <= maxClients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (!IsClientConnected(i) || IsFakeClient(i))
|
||||
{
|
||||
@@ -407,11 +405,9 @@ FindColor(String:color[])
|
||||
|
||||
SendChatToAll(client, String:message[])
|
||||
{
|
||||
new maxClients;
|
||||
new String:nameBuf[MAX_NAME_LENGTH];
|
||||
|
||||
maxClients = GetMaxClients();
|
||||
for (new i = 1; i <= maxClients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (!IsClientConnected(i) || IsFakeClient(i))
|
||||
{
|
||||
@@ -433,9 +429,8 @@ SendChatToAll(client, String:message[])
|
||||
DisplayCenterTextToAll(client, String:message[])
|
||||
{
|
||||
new String:nameBuf[MAX_NAME_LENGTH];
|
||||
new maxClients = GetMaxClients();
|
||||
|
||||
for (new i = 1; i < maxClients; i++)
|
||||
for (new i = 1; i < MaxClients; i++)
|
||||
{
|
||||
if (!IsClientConnected(i) || IsFakeClient(i))
|
||||
{
|
||||
@@ -448,9 +443,7 @@ DisplayCenterTextToAll(client, String:message[])
|
||||
|
||||
SendChatToAdmins(String:name[], String:message[])
|
||||
{
|
||||
new iMaxClients = GetMaxClients();
|
||||
|
||||
for (new i = 1; i <= iMaxClients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (IsClientInGame(i))
|
||||
{
|
||||
@@ -500,8 +493,7 @@ SendPanelToAll(String:name[], String:message[])
|
||||
SetPanelCurrentKey(mSayPanel, 10);
|
||||
DrawPanelItem(mSayPanel, "Exit", ITEMDRAW_CONTROL);
|
||||
|
||||
new MaxClients = GetMaxClients();
|
||||
for(new i = 1; i < MaxClients; i++)
|
||||
for(new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if(IsClientInGame(i) && !IsFakeClient(i))
|
||||
{
|
||||
|
||||
@@ -45,9 +45,19 @@ enum NetFlow
|
||||
NetFlow_Both, /**< Both values added together */
|
||||
};
|
||||
|
||||
#define MAXPLAYERS 64 /**< Maximum number of players that can be in server */
|
||||
/**
|
||||
* MAXPLAYERS is not the same as MaxClients.
|
||||
* MAXPLAYERS is a hardcoded value as an upper limit. MaxClients changes based on the server.
|
||||
*
|
||||
* Both GetMaxClients() and MaxClients are only available once the map is loaded, and should
|
||||
* not be used in OnPluginStart().
|
||||
*/
|
||||
|
||||
#define MAXPLAYERS 64 /**< Maximum number of players SourceMod supports */
|
||||
#define MAX_NAME_LENGTH 32 /**< Maximum buffer required to store a client name */
|
||||
|
||||
public const MaxClients; /**< Maximum number of players the server supports (dynamic) */
|
||||
|
||||
/**
|
||||
* Called on client connection.
|
||||
*
|
||||
@@ -169,10 +179,16 @@ forward OnClientPostAdminFilter(client);
|
||||
forward OnClientPostAdminCheck(client);
|
||||
|
||||
/**
|
||||
* This function will be deprecated in a future release. Use the MaxClients variable instead.
|
||||
*
|
||||
* 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().
|
||||
*
|
||||
* You should not globally cache the value to GetMaxClients() because it can change from
|
||||
* SourceTV or TF2's arena mode. Use the "MaxClients" dynamic variable documented at the
|
||||
* top of this file.
|
||||
*
|
||||
* @return Maximum number of clients allowed.
|
||||
*/
|
||||
native GetMaxClients();
|
||||
|
||||
@@ -37,7 +37,9 @@
|
||||
|
||||
#include <version>
|
||||
|
||||
#define SOURCEMOD_PLUGINAPI_VERSION 3
|
||||
/** If this gets changed, you need to update Core's check. */
|
||||
#define SOURCEMOD_PLUGINAPI_VERSION 4
|
||||
|
||||
struct PlVers
|
||||
{
|
||||
version,
|
||||
@@ -136,6 +138,25 @@ struct SharedPlugin
|
||||
public Float:NULL_VECTOR[3]; /**< Pass this into certain functions to act as a C++ NULL */
|
||||
public const String:NULL_STRING[1]; /**< pass this into certain functions to act as a C++ NULL */
|
||||
|
||||
/**
|
||||
* Horrible compatibility shim.
|
||||
*/
|
||||
public Extension:__ext_core =
|
||||
{
|
||||
name = "Core",
|
||||
file = "core",
|
||||
autoload = 0,
|
||||
required = 0,
|
||||
};
|
||||
|
||||
native VerifyCoreVersion();
|
||||
|
||||
public __ext_core_SetNTVOptional()
|
||||
{
|
||||
VerifyCoreVersion();
|
||||
}
|
||||
|
||||
|
||||
#define AUTOLOAD_EXTENSIONS
|
||||
#define REQUIRE_EXTENSIONS
|
||||
#define REQUIRE_PLUGIN
|
||||
|
||||
Reference in New Issue
Block a user