mirror of
https://codeberg.org/spire/autoexec.git
synced 2026-06-03 10:14:07 +02:00
warn about whitelist
This commit is contained in:
parent
a6425fb19d
commit
d603db9613
2 changed files with 38 additions and 1 deletions
Binary file not shown.
|
|
@ -22,6 +22,7 @@ bool warned[4] = {false, false, false, false}; // size 4 so we can use team inde
|
|||
new Handle:CvarLeague = INVALID_HANDLE;
|
||||
new Handle:CvarMode = INVALID_HANDLE;
|
||||
new Handle:CvarAutoset = INVALID_HANDLE;
|
||||
new Handle:CvarWhitelist = INVALID_HANDLE;
|
||||
|
||||
public OnPluginStart() {
|
||||
mapPrefixMap = new StringMap();
|
||||
|
|
@ -34,6 +35,8 @@ public OnPluginStart() {
|
|||
CvarMode = CreateConVar("sm_autoexec_mode", "9v9", "game mode to execute the config for (9v9, 6v6 or 4v4)", FCVAR_PROTECTED);
|
||||
CvarAutoset = CreateConVar("sm_autoexec_autoset", "true", "try to set league and mode when a config is manually loaded (true or false)", FCVAR_PROTECTED);
|
||||
|
||||
CvarWhitelist = FindConVar("mp_tournament_whitelist");
|
||||
|
||||
RegServerCmd("sm_autoexec", AutoExec, "Execute the config for the current map and select league and game mode");
|
||||
RegServerCmd("sm_getexec", GetExec, "Get the name of the config for a specific map");
|
||||
RegServerCmd("exec", HandleExecAction);
|
||||
|
|
@ -219,13 +222,15 @@ public ExecCFG(String:cfg[128]) {
|
|||
|
||||
public Action clearInAutoExec(Handle timer) {
|
||||
inAutoExec = false;
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public void OnReadyUp(Event event, const String:name[], bool:dontBroadcast) {
|
||||
|
||||
bool redReady = GameRules_GetProp("m_bTeamReady", 1, .element=2) != 0;
|
||||
bool blueReady = GameRules_GetProp("m_bTeamReady", 1, .element=3) != 0;
|
||||
|
||||
CheckWhitelist();
|
||||
|
||||
if (redReady) {
|
||||
CheckPlayerCount(2);
|
||||
}
|
||||
|
|
@ -252,3 +257,35 @@ public void CheckPlayerCount(int team) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckWhitelist() {
|
||||
decl String:whitelist[128];
|
||||
GetConVarString(CvarWhitelist, whitelist, sizeof(whitelist));
|
||||
|
||||
decl String:expected[128];
|
||||
GetExpectedWhitelist(expected);
|
||||
|
||||
if (strncmp(expected, whitelist, strlen(whitelist)) == 0) {
|
||||
PrintToChatAll("Warning, incorrect whitelist loaded for game mode: %s", whitelist);
|
||||
}
|
||||
}
|
||||
|
||||
public GetExpectedWhitelist(String:whitelist[128]) {
|
||||
decl String:league[8];
|
||||
decl String:gamemode[8];
|
||||
|
||||
whitelist = "";
|
||||
if (strncmp("ugc", league, strlen(league)) == 0) {
|
||||
if (strncmp("9v9", gamemode, strlen(gamemode)) == 0) {
|
||||
whitelist = "cfg/item_whitelist_ugc_HL.txt";
|
||||
} else if (strncmp("6v6", gamemode, strlen(gamemode)) == 0) { {
|
||||
whitelist = "cfg/item_whitelist_ugc_6v6.txt";
|
||||
}
|
||||
} else if (strncmp("etf2l", league, strlen(league)) == 0) {
|
||||
if (strncmp("9v9", gamemode, strlen(gamemode)) == 0) {
|
||||
whitelist = "cfg/etf2l_whitelist_9v9.txt";
|
||||
} else if (strncmp("6v6", gamemode, strlen(gamemode)) == 0) { {
|
||||
whitelist = "cfg/etf2l_whitelist_6v6.txt";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue