From edbbc688f3104bc2d067dac5cf322ec697cd4b03 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Thu, 4 Jun 2009 21:56:55 -0700 Subject: [PATCH] Fixed config reload command translation, and made it support multiple file aliases to reload. --- .../translations/zombiereloaded.phrases.txt | 6 +-- src/zr/config.inc | 46 ++++++++++--------- src/zr/weapons/restrict.inc | 1 - 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt index 288f04b..48f6234 100644 --- a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt +++ b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt @@ -90,7 +90,7 @@ "Config command reload syntax" { "#format" "{1:s},{2:s},{3:s},{4:s},{5:s}" - "en" "Syntax: zr_reloadconfig - Reloads a config file.\n File Aliases:\n * \"{1}\"\n * \"{2}\"\n * \"{3}\"\n * \"{4}\"\n * \"{5}\"" + "en" "Syntax: zr_reloadconfig [file alias2] ... - Reloads a config file.\n File Aliases:\n * \"{1}\"\n * \"{2}\"\n * \"{3}\"\n * \"{4}\"\n * \"{5}\"" } "Config command reload invalid" @@ -102,12 +102,12 @@ "Config command reload not loaded" { "#format" "{1:s}" - "en" "File failed to load: \"{1}\" (Either disabled or invalid file content.)" + "en" "Config file \"{1}\" failed to load. (Either disabled or invalid file content.)" } "Config command reload all stats begin" { - "en" "Reloading all Zombie:Reloaded config files...\n ------------------------------------------" + "en" "Reloading all Zombie:Reloaded config files...\n ------------------------------------------------" } "Config command reload all stats successful" diff --git a/src/zr/config.inc b/src/zr/config.inc index 70571d8..38c1472 100644 --- a/src/zr/config.inc +++ b/src/zr/config.inc @@ -786,30 +786,34 @@ public Action:ConfigReloadCommand(client, argc) return Plugin_Handled; } - // arg1 = file alias being reloaded. - decl String:arg1[32]; - GetCmdArg(1, arg1, sizeof(arg1)); - - // If alias is invalid, then stop. - new ConfigFile:config = ConfigAliasToConfigFile(arg1); - if (config == File_Invalid) - { - TranslationReplyToCommand(client, "Config command reload invalid", arg1); - return Plugin_Handled; - } - - // Reload config file. - new bool:loaded = ConfigReloadConfig(config); - - // Get config file path. + decl String:filealias[CONFIG_MAX_LENGTH]; decl String:path[PLATFORM_MAX_PATH]; - ConfigGetConfigPath(config, path, sizeof(path)); - // If file isn't loaded then tell client, then stop. - if (!loaded) + new args = GetCmdArgs(); + for (new x = 1; x <= args; x++) { - TranslationReplyToCommand(client, "Config command reload not loaded", path); - return Plugin_Handled; + // Get alias to restrict. + GetCmdArg(x, filealias, sizeof(filealias)); + + // If alias is invalid, then stop. + new ConfigFile:config = ConfigAliasToConfigFile(filealias); + if (config == File_Invalid) + { + TranslationReplyToCommand(client, "Config command reload invalid", filealias); + return Plugin_Handled; + } + + // Reload config file. + new bool:loaded = ConfigReloadConfig(config); + + // Get config file path. + ConfigGetConfigPath(config, path, sizeof(path)); + + // If file isn't loaded then tell client, then stop. + if (!loaded) + { + TranslationReplyToCommand(client, "Config command reload not loaded", filealias); + } } return Plugin_Handled; diff --git a/src/zr/weapons/restrict.inc b/src/zr/weapons/restrict.inc index 2189e68..cbd6561 100644 --- a/src/zr/weapons/restrict.inc +++ b/src/zr/weapons/restrict.inc @@ -597,7 +597,6 @@ public Action:RestrictCommand(client, argc) return Plugin_Handled; } - // arg1 = weapon being restricted decl String:target[WEAPONS_MAX_LENGTH]; new args = GetCmdArgs();