#include <amxmodx>
#define PLUGIN_NAME "FileRenamer"
public plugin_init()
{
register_plugin(PLUGIN_NAME, "1.0", "Your Name");
register_clcmd("rename_configs_file", "RenameConfigsFileCmd");
register_clcmd("restore_configs_file", "RestoreConfigsFileCmd");
}
public RenameConfigsFileCmd(id)
{
new oldFileName[PLATFORM_MAX_PATH], newFileName[PLATFORM_MAX_PATH];
format(oldFileName, sizeof(oldFileName) - 1, "addons/amxmodx/configs/plugins.ini");
format(newFileName, sizeof(newFileName) - 1, "addons/amxmodx/configs/;plugins.ini");
if (rename_file(oldFileName, newFileName, 1))
{
client_print(id, print_chat, "File renamed successfully.");
}
else
{
client_print(id, print_chat, "Failed to rename file.");
}
}
public RestoreConfigsFileCmd(id)
{
new oldFileName[PLATFORM_MAX_PATH], newFileName[PLATFORM_MAX_PATH];
format(oldFileName, sizeof(oldFileName) - 1, "addons/amxmodx/configs/;plugins.ini");
format(newFileName, sizeof(newFileName) - 1, "addons/amxmodx/configs/plugins.ini");
if (rename_file(oldFileName, newFileName, 1))
{
client_print(id, print_chat, "File name restored successfully.");
}
else
{
client_print(id, print_chat, "Failed to restore file name.");
}
}