Sure. I modified the tf2items_manager plugin to include a ConVar (
tf2items_manager_config) which allows you to switch the config file from which the plugin will read custom items.
Plugin changes:
- Added under variable declaration section:
PHP Code:
new Handle:g_hCvarConfigFile;
- Added under OnPluginStart() forward:
PHP Code:
g_hCvarConfigFile = CreateConVar("tf2items_manager_config", "tf2items.weapons.txt", "Specifies the name of the config from which the plugin will read custom items.");
- Moved item parsing from OnPluginStart() to OnConfigsExecuted():
PHP Code:
public OnConfigsExecuted()
{
decl String:configName[PLATFORM_MAX_PATH];
GetConVarString(g_hCvarConfigFile, configName, sizeof(configName));
// Parse the items list
ParseItems(configName);
}
- Updated the CmdReload() callback:
PHP Code:
decl String:configName[PLATFORM_MAX_PATH];
GetConVarString(g_hCvarConfigFile, configName, sizeof(configName));
// Call the ParseItems function.
ParseItems(configName);
- Updated the ParseItems() function to take the config name as an argument:
PHP Code:
ParseItems(const String:configName[])
...
// Create key values object and parse file.
BuildPath(Path_SM, strBuffer, sizeof(strBuffer), "configs/%s", configName);