mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 21:53:21 +00:00
Add check for max players cvar
This commit is contained in:
parent
71889d6788
commit
5b490def66
2 changed files with 6 additions and 5 deletions
Binary file not shown.
|
@ -100,9 +100,11 @@ public void OnPluginStart() {
|
||||||
hForceSurvivorSet = FindConVar("l4d_force_survivorset");
|
hForceSurvivorSet = FindConVar("l4d_force_survivorset");
|
||||||
|
|
||||||
hSVMaxPlayers = FindConVar("sv_maxplayers");
|
hSVMaxPlayers = FindConVar("sv_maxplayers");
|
||||||
|
if(hSVMaxPlayers != null) {
|
||||||
hPlayerLimit = CreateConVar("sm_player_limit", "0", "Overrides sv_maxplayers. 0 = off, > 0: limit", FCVAR_NONE, true, 0.0, false);
|
hPlayerLimit = CreateConVar("sm_player_limit", "0", "Overrides sv_maxplayers. 0 = off, > 0: limit", FCVAR_NONE, true, 0.0, false);
|
||||||
hPlayerLimit.AddChangeHook(Event_PlayerLimitChange);
|
hPlayerLimit.AddChangeHook(Event_PlayerLimitChange);
|
||||||
hSVMaxPlayers.IntValue = hPlayerLimit.IntValue;
|
hSVMaxPlayers.IntValue = hPlayerLimit.IntValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
hFFNotice.AddChangeHook(CVC_FFNotice);
|
hFFNotice.AddChangeHook(CVC_FFNotice);
|
||||||
|
@ -675,8 +677,7 @@ public void OnMapStart() {
|
||||||
}
|
}
|
||||||
public void OnConfigsExecuted() {
|
public void OnConfigsExecuted() {
|
||||||
isL4D1Survivors = L4D2_GetSurvivorSetMap() == 1;
|
isL4D1Survivors = L4D2_GetSurvivorSetMap() == 1;
|
||||||
|
if(hSVMaxPlayers != null && hPlayerLimit.IntValue > 0) {
|
||||||
if(hPlayerLimit.IntValue > 0) {
|
|
||||||
hSVMaxPlayers.IntValue = hPlayerLimit.IntValue;
|
hSVMaxPlayers.IntValue = hPlayerLimit.IntValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue