1
0
Fork 0
mirror of https://codeberg.org/spire/autoexec.git synced 2026-06-03 18:24:06 +02:00

fix error

This commit is contained in:
Robin Appelman 2025-10-21 22:15:02 +02:00
commit e369f0a428

View file

@ -17,7 +17,7 @@ new StringMap:mapTypeMap;
new StringMap:gameModeMap;
new StringMap:configOverwriteMap;
bool inAutoExec = false;
bool[4] warned = {false, false, false, false}; // size 4 so we can use team indexes
bool warned[4] = {false, false, false, false}; // size 4 so we can use team indexes
new Handle:CvarLeague = INVALID_HANDLE;
new Handle:CvarMode = INVALID_HANDLE;
@ -37,9 +37,9 @@ public OnPluginStart() {
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);
mapTypeMap.SetString("5cp", "standard");
mapPrefixMap.SetString("pl_", "stopwatch");
mapPrefixMap.SetString("cp_", "5cp");
mapPrefixMap.SetString("koth_", "koth");
@ -48,12 +48,12 @@ public OnPluginStart() {
configOverwriteMap.SetString("ultiduo_", "etf2l_ultiduo");
configOverwriteMap.SetString("bball_", "etf2l_bball");
configOverwriteMap.SetString("ctf_bball", "etf2l_bball");
mapOverwriteMap.SetString("cp_steel", "stopwatch");
mapOverwriteMap.SetString("cp_gravelpit", "stopwatch");
mapOverwriteMap.SetString("cp_hadal", "stopwatch");
mapOverwriteMap.SetString("cp_alloy", "stopwatch");
gameModeMap.SetString("9v9", "hl");
gameModeMap.SetString("6v6", "6v");
@ -65,7 +65,7 @@ public OnMapStart() {
decl String:map[128];
GetCurrentMap(map, sizeof(map));
GetConfig(map, config);
ExecCFG(config);
}
@ -106,7 +106,7 @@ public Action:HandleExecAction(args) {
PrintToChatAll("Setting game mode to 6v6");
SetConVarString(CvarMode, "6v6");
}
if (StrContains(cfg, "4v4_") > 0) {
PrintToChatAll("Setting game mode to 4v4");
SetConVarString(CvarMode, "4v4");
@ -130,7 +130,7 @@ public Action:AutoExec(args) {
decl String:map[128];
GetCurrentMap(map, sizeof(map));
GetConfig(map, config);
ExecCFG(config);
return Plugin_Handled;
}
@ -161,7 +161,7 @@ public GetConfig(String:map[128], String:config[128]) {
if (PrefixSearch(configOverwriteMap, map, config)) {
return;
}
GetLeague(league);
GetLeagueMapType(map, mapType, league);
GetGameMode(gamemode, league);
@ -176,7 +176,7 @@ public GetLeague(String:league[8]) {
public GetGameMode(String:leagueGamemode[8], String:league[8]) {
decl String:gamemode[8];
GetConVarString(CvarMode, gamemode, sizeof(gamemode));
if (strncmp("ugc", league, strlen(league)) == 0) {
if (gameModeMap.GetString(gamemode, leagueGamemode, sizeof(leagueGamemode))) {
return;
@ -251,4 +251,4 @@ public void CheckPlayerCount(int team) {
PrintToChatAll("Warning, config is set to 6v6 but you readied up with %d players", playerCount);
}
}
}
}