Fixed config reload command translation, and made it support multiple file aliases to reload.

This commit is contained in:
Greyscale 2009-06-04 21:56:55 -07:00
parent e1e38fdf2d
commit edbbc688f3
3 changed files with 28 additions and 25 deletions

View File

@ -90,7 +90,7 @@
"Config command reload syntax" "Config command reload syntax"
{ {
"#format" "{1:s},{2:s},{3:s},{4:s},{5:s}" "#format" "{1:s},{2:s},{3:s},{4:s},{5:s}"
"en" "Syntax: zr_reloadconfig <file alias> - Reloads a config file.\n File Aliases:\n * \"{1}\"\n * \"{2}\"\n * \"{3}\"\n * \"{4}\"\n * \"{5}\"" "en" "Syntax: zr_reloadconfig <file alias1> [file alias2] ... - Reloads a config file.\n File Aliases:\n * \"{1}\"\n * \"{2}\"\n * \"{3}\"\n * \"{4}\"\n * \"{5}\""
} }
"Config command reload invalid" "Config command reload invalid"
@ -102,12 +102,12 @@
"Config command reload not loaded" "Config command reload not loaded"
{ {
"#format" "{1:s}" "#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" "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" "Config command reload all stats successful"

View File

@ -786,30 +786,34 @@ public Action:ConfigReloadCommand(client, argc)
return Plugin_Handled; return Plugin_Handled;
} }
// arg1 = file alias being reloaded. decl String:filealias[CONFIG_MAX_LENGTH];
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:path[PLATFORM_MAX_PATH]; decl String:path[PLATFORM_MAX_PATH];
ConfigGetConfigPath(config, path, sizeof(path));
// If file isn't loaded then tell client, then stop. new args = GetCmdArgs();
if (!loaded) for (new x = 1; x <= args; x++)
{ {
TranslationReplyToCommand(client, "Config command reload not loaded", path); // Get alias to restrict.
return Plugin_Handled; 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; return Plugin_Handled;

View File

@ -597,7 +597,6 @@ public Action:RestrictCommand(client, argc)
return Plugin_Handled; return Plugin_Handled;
} }
// arg1 = weapon being restricted
decl String:target[WEAPONS_MAX_LENGTH]; decl String:target[WEAPONS_MAX_LENGTH];
new args = GetCmdArgs(); new args = GetCmdArgs();