Fixed base plugins using GetMaxClients() instead of MaxClients (bug 3985, r=dvander).
This commit is contained in:
parent
d484979fe8
commit
0af39de346
@ -526,9 +526,7 @@ FetchUser(Handle:db, client)
|
||||
|
||||
FetchUsersWeCan(Handle:db)
|
||||
{
|
||||
new max_clients = GetMaxClients();
|
||||
|
||||
for (new i=1; i<=max_clients; i++)
|
||||
for (new i=1; i<=MaxClients; i++)
|
||||
{
|
||||
if (PlayerAuth[i] && GetUserAdmin(i) == INVALID_ADMIN_ID)
|
||||
{
|
||||
|
@ -45,8 +45,6 @@ public Plugin:myinfo =
|
||||
url = "http://www.sourcemod.net/"
|
||||
};
|
||||
|
||||
new g_maxPlayers;
|
||||
|
||||
/* Forwards */
|
||||
new Handle:hOnAdminMenuReady = INVALID_HANDLE;
|
||||
new Handle:hOnAdminMenuCreated = INVALID_HANDLE;
|
||||
@ -97,8 +95,6 @@ public OnConfigsExecuted()
|
||||
|
||||
public OnMapStart()
|
||||
{
|
||||
g_maxPlayers = GetMaxClients();
|
||||
|
||||
ParseConfigs();
|
||||
}
|
||||
|
||||
@ -215,14 +211,13 @@ public Action:Command_DisplayMenu(client, args)
|
||||
|
||||
stock UTIL_AddTargetsToMenu2(Handle:menu, source_client, flags)
|
||||
{
|
||||
new max_clients = GetMaxClients();
|
||||
decl String:user_id[12];
|
||||
decl String:name[MAX_NAME_LENGTH];
|
||||
decl String:display[MAX_NAME_LENGTH+12];
|
||||
|
||||
new num_clients;
|
||||
|
||||
for (new i = 1; i <= max_clients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (!IsClientConnected(i) || IsClientInKickQueue(i))
|
||||
{
|
||||
|
@ -512,7 +512,7 @@ public ParamCheck(client)
|
||||
new String:temp[4];
|
||||
|
||||
//loop through players. Add name as text and name/userid/steamid as info
|
||||
for (new i=1; i<=g_maxPlayers; i++)
|
||||
for (new i=1; i<=MaxClients; i++)
|
||||
{
|
||||
if (IsClientInGame(i))
|
||||
{
|
||||
|
@ -157,9 +157,8 @@ public Action:Command_Say(client, args)
|
||||
public ConVarChange_Alltalk(Handle:convar, const String:oldValue[], const String:newValue[])
|
||||
{
|
||||
new mode = GetConVarInt(g_Cvar_Deadtalk);
|
||||
new maxClients = GetMaxClients();
|
||||
|
||||
for (new i = 1; i <= maxClients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (!IsClientInGame(i))
|
||||
{
|
||||
|
@ -189,10 +189,9 @@ public Action:Command_Who(client, args)
|
||||
}
|
||||
|
||||
/* List all players */
|
||||
new maxClients = GetMaxClients();
|
||||
decl String:flagstring[255];
|
||||
|
||||
for (new i=1; i<=maxClients; i++)
|
||||
for (new i=1; i<=MaxClients; i++)
|
||||
{
|
||||
if (!IsClientInGame(i))
|
||||
{
|
||||
|
@ -53,9 +53,7 @@ KillBeacon(client)
|
||||
|
||||
KillAllBeacons()
|
||||
{
|
||||
new maxclients = GetMaxClients();
|
||||
|
||||
for (new i = 1; i <= maxclients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
KillBeacon(i);
|
||||
}
|
||||
|
@ -74,8 +74,7 @@ KillDrugTimer(client)
|
||||
|
||||
KillAllDrugs()
|
||||
{
|
||||
new maxclients = GetMaxClients();
|
||||
for (new i = 1; i <= maxclients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (g_DrugTimers[i] != INVALID_HANDLE)
|
||||
{
|
||||
|
@ -58,9 +58,7 @@ KillFireBomb(client)
|
||||
|
||||
KillAllFireBombs()
|
||||
{
|
||||
new maxclients = GetMaxClients();
|
||||
|
||||
for (new i = 1; i <= maxclients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
KillFireBomb(i);
|
||||
}
|
||||
@ -162,9 +160,8 @@ public Action:Timer_FireBomb(Handle:timer, any:value)
|
||||
if (GetConVarInt(g_Cvar_FireBombMode) > 0)
|
||||
{
|
||||
new teamOnly = ((GetConVarInt(g_Cvar_FireBombMode) == 1) ? true : false);
|
||||
new maxClients = GetMaxClients();
|
||||
|
||||
for (new i = 1; i <= maxClients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
|
||||
{
|
||||
|
@ -105,9 +105,7 @@ KillFreezeBomb(client)
|
||||
|
||||
KillAllFreezes( )
|
||||
{
|
||||
new maxclients = GetMaxClients( );
|
||||
|
||||
for(new i = 1; i <= maxclients; i++)
|
||||
for(new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (g_FreezeSerial[i] != 0)
|
||||
{
|
||||
@ -254,9 +252,8 @@ public Action:Timer_FreezeBomb(Handle:timer, any:value)
|
||||
if (GetConVarInt(g_Cvar_FreezeBombMode) > 0)
|
||||
{
|
||||
new bool:teamOnly = ((GetConVarInt(g_Cvar_FreezeBombMode) == 1) ? true : false);
|
||||
new maxClients = GetMaxClients( );
|
||||
|
||||
for (new i = 1; i <= maxClients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
|
||||
{
|
||||
|
@ -57,9 +57,7 @@ KillTimeBomb(client)
|
||||
|
||||
KillAllTimeBombs()
|
||||
{
|
||||
new maxclients = GetMaxClients();
|
||||
|
||||
for (new i = 1; i <= maxclients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
KillTimeBomb(i);
|
||||
}
|
||||
@ -141,9 +139,8 @@ public Action:Timer_TimeBomb(Handle:timer, any:value)
|
||||
if (GetConVarInt(g_Cvar_TimeBombMode) > 0)
|
||||
{
|
||||
new teamOnly = ((GetConVarInt(g_Cvar_TimeBombMode) == 1) ? true : false);
|
||||
new maxClients = GetMaxClients();
|
||||
|
||||
for (new i = 1; i <= maxClients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
|
||||
{
|
||||
|
@ -273,10 +273,9 @@ native PrintToChat(client, const String:format[], any:...);
|
||||
*/
|
||||
stock PrintToChatAll(const String:format[], any:...)
|
||||
{
|
||||
new maxClients = GetMaxClients();
|
||||
decl String:buffer[192];
|
||||
|
||||
for (new i = 1; i <= maxClients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (IsClientInGame(i))
|
||||
{
|
||||
@ -307,10 +306,9 @@ native PrintCenterText(client, const String:format[], any:...);
|
||||
*/
|
||||
stock PrintCenterTextAll(const String:format[], any:...)
|
||||
{
|
||||
new maxClients = GetMaxClients();
|
||||
decl String:buffer[192];
|
||||
|
||||
for (new i = 1; i <= maxClients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (IsClientInGame(i))
|
||||
{
|
||||
@ -341,10 +339,9 @@ native PrintHintText(client, const String:format[], any:...);
|
||||
*/
|
||||
stock PrintHintTextToAll(const String:format[], any:...)
|
||||
{
|
||||
new maxClients = GetMaxClients();
|
||||
decl String:buffer[192];
|
||||
|
||||
for (new i = 1; i <= maxClients; i++)
|
||||
for (new i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (IsClientInGame(i))
|
||||
{
|
||||
|
@ -99,7 +99,6 @@ stock Handle:FindPluginByFile(const String:filename[])
|
||||
#pragma deprecated Use FindTarget() or ProcessTargetString()
|
||||
stock SearchForClients(const String:pattern[], clients[], maxClients)
|
||||
{
|
||||
new maxclients = GetMaxClients();
|
||||
new total = 0;
|
||||
|
||||
if (maxClients == 0)
|
||||
@ -113,7 +112,7 @@ stock SearchForClients(const String:pattern[], clients[], maxClients)
|
||||
if (!input)
|
||||
{
|
||||
decl String:name[65]
|
||||
for (new i=1; i<=maxclients; i++)
|
||||
for (new i=1; i<=MaxClients; i++)
|
||||
{
|
||||
if (!IsClientInGame(i))
|
||||
{
|
||||
@ -137,7 +136,7 @@ stock SearchForClients(const String:pattern[], clients[], maxClients)
|
||||
}
|
||||
|
||||
decl String:name[65]
|
||||
for (new i=1; i<=maxclients; i++)
|
||||
for (new i=1; i<=MaxClients; i++)
|
||||
{
|
||||
if (!IsClientInGame(i))
|
||||
{
|
||||
|
@ -490,11 +490,10 @@ native bool:VoteMenu(Handle:menu, clients[], numClients, time, flags=0);
|
||||
*/
|
||||
stock VoteMenuToAll(Handle:menu, time, flags=0)
|
||||
{
|
||||
new num = GetMaxClients();
|
||||
new total;
|
||||
decl players[num];
|
||||
decl players[MaxClients];
|
||||
|
||||
for (new i=1; i<=num; i++)
|
||||
for (new i=1; i<=MaxClients; i++)
|
||||
{
|
||||
if (!IsClientInGame(i))
|
||||
{
|
||||
|
@ -403,11 +403,10 @@ stock EmitSoundToAll(const String:sample[],
|
||||
bool:updatePos = true,
|
||||
Float:soundtime = 0.0)
|
||||
{
|
||||
new maxClients = GetMaxClients();
|
||||
new clients[maxClients];
|
||||
new total = 0;
|
||||
|
||||
for (new i=1; i<=maxClients; i++)
|
||||
for (new i=1; i<=MaxClients; i++)
|
||||
{
|
||||
if (IsClientInGame(i))
|
||||
{
|
||||
|
@ -197,10 +197,9 @@ stock TE_WriteEncodedEnt(const String:prop[], value)
|
||||
*/
|
||||
stock TE_SendToAll(Float:delay=0.0)
|
||||
{
|
||||
new maxClients = GetMaxClients();
|
||||
new total = 0;
|
||||
new clients[maxClients];
|
||||
for (new i=1; i<=maxClients; i++)
|
||||
new clients[MaxClients];
|
||||
for (new i=1; i<=MaxClients; i++)
|
||||
{
|
||||
if (IsClientInGame(i))
|
||||
{
|
||||
|
@ -170,10 +170,9 @@ native UnhookUserMessage(UserMsg:msg_id, MsgHook:hook, bool:intercept=false);
|
||||
*/
|
||||
stock Handle:StartMessageAll(String:msgname[], flags=0)
|
||||
{
|
||||
new maxClients = GetMaxClients();
|
||||
new total = 0;
|
||||
new clients[maxClients];
|
||||
for (new i=1; i<=maxClients; i++)
|
||||
new clients[MaxClients];
|
||||
for (new i=1; i<=MaxClients; i++)
|
||||
{
|
||||
if (IsClientConnected(i))
|
||||
{
|
||||
|
@ -224,6 +224,4 @@ FormatTimeDuration(String:buffer[], maxlen, time)
|
||||
{
|
||||
return Format(buffer, maxlen, "%is", seconds);
|
||||
}
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
@ -44,8 +44,6 @@ public Plugin:myinfo =
|
||||
url = "http://www.sourcemod.net/"
|
||||
};
|
||||
|
||||
/* Maximum number of clients that can connect to server */
|
||||
new g_MaxClients;
|
||||
new g_adminCount = 0;
|
||||
new bool:g_isAdmin[MAXPLAYERS+1];
|
||||
|
||||
@ -82,16 +80,14 @@ public OnPluginStart()
|
||||
public OnPluginEnd()
|
||||
{
|
||||
/* If the plugin has been unloaded, reset visiblemaxplayers. In the case of the server shutting down this effect will not be visible */
|
||||
SetConVarInt(sv_visiblemaxplayers, g_MaxClients);
|
||||
SetConVarInt(sv_visiblemaxplayers, MaxClients);
|
||||
}
|
||||
|
||||
public OnMapStart()
|
||||
{
|
||||
g_MaxClients = GetMaxClients();
|
||||
|
||||
if (GetConVarBool(sm_hide_slots))
|
||||
{
|
||||
SetVisibleMaxSlots(GetClientCount(false), g_MaxClients - GetConVarInt(sm_reserved_slots));
|
||||
SetVisibleMaxSlots(GetClientCount(false), MaxClients - GetConVarInt(sm_reserved_slots));
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,7 +95,7 @@ public OnConfigsExecuted()
|
||||
{
|
||||
if (GetConVarBool(sm_hide_slots))
|
||||
{
|
||||
SetVisibleMaxSlots(GetClientCount(false), g_MaxClients - GetConVarInt(sm_reserved_slots));
|
||||
SetVisibleMaxSlots(GetClientCount(false), MaxClients - GetConVarInt(sm_reserved_slots));
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,7 +110,7 @@ public Action:OnTimedKick(Handle:timer, any:client)
|
||||
|
||||
if (GetConVarBool(sm_hide_slots))
|
||||
{
|
||||
SetVisibleMaxSlots(GetClientCount(false), g_MaxClients - GetConVarInt(sm_reserved_slots));
|
||||
SetVisibleMaxSlots(GetClientCount(false), MaxClients - GetConVarInt(sm_reserved_slots));
|
||||
}
|
||||
|
||||
return Plugin_Handled;
|
||||
@ -127,7 +123,7 @@ public OnClientPostAdminCheck(client)
|
||||
if (reserved > 0)
|
||||
{
|
||||
new clients = GetClientCount(false);
|
||||
new limit = g_MaxClients - reserved;
|
||||
new limit = MaxClients - reserved;
|
||||
new flags = GetUserFlagBits(client);
|
||||
|
||||
new type = GetConVarInt(sm_reserve_type);
|
||||
@ -204,7 +200,7 @@ public OnClientDisconnect_Post(client)
|
||||
{
|
||||
if (GetConVarBool(sm_hide_slots))
|
||||
{
|
||||
SetVisibleMaxSlots(GetClientCount(false), g_MaxClients - GetConVarInt(sm_reserved_slots));
|
||||
SetVisibleMaxSlots(GetClientCount(false), MaxClients - GetConVarInt(sm_reserved_slots));
|
||||
}
|
||||
|
||||
if (g_isAdmin[client])
|
||||
@ -219,7 +215,7 @@ public SlotsChanged(Handle:convar, const String:oldValue[], const String:newValu
|
||||
/* Reserved slots or hidden slots have been disabled - reset sv_visiblemaxplayers */
|
||||
if (StringToInt(newValue) == 0)
|
||||
{
|
||||
SetConVarInt(sv_visiblemaxplayers, g_MaxClients);
|
||||
SetConVarInt(sv_visiblemaxplayers, MaxClients);
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,9 +223,9 @@ SetVisibleMaxSlots(clients, limit)
|
||||
{
|
||||
new num = clients;
|
||||
|
||||
if (clients == g_MaxClients)
|
||||
if (clients == MaxClients)
|
||||
{
|
||||
num = g_MaxClients;
|
||||
num = MaxClients;
|
||||
} else if (clients < limit) {
|
||||
num = limit;
|
||||
}
|
||||
@ -251,7 +247,7 @@ SelectKickClient()
|
||||
|
||||
new Float:value;
|
||||
|
||||
for (new i=1; i<=g_MaxClients; i++)
|
||||
for (new i=1; i<=MaxClients; i++)
|
||||
{
|
||||
if (!IsClientConnected(i))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user