#include <sourcemod>
#include <sdktools>
#include <smlib>
#define PLUGIN_VERSION "1.1"
new String:s_DownListPath[PLATFORM_MAX_PATH];
new Handle:h_DownListPath;
public Plugin:myinfo =
{
name = "Downloads",
author = "FrozDark (HLModders.ru LLC)",
description = "downloads",
version = PLUGIN_VERSION,
url = "www.hlmod.ru"
}
public OnPluginStart()
{
h_DownListPath = CreateConVar("sm_downloadslist", "cfg/sourcemod/downloadslist.txt", "Path to the downloadslist");
}
public OnConfigsExecuted()
{
GetConVarString(h_DownListPath, s_DownListPath, sizeof(s_DownListPath));
HookConVarChange(h_DownListPath, CvarChanges);
if (FileExists(s_DownListPath))
File_ReadDownloadList(s_DownListPath);
else
LogError("Downloadslist '%s' not found", s_DownListPath);
}
public CvarChanges(Handle:convar, const String:oldValue[], const String:newValue[])
{
if (convar == h_DownListPath)
{
strcopy(s_DownListPath, sizeof(s_DownListPath), newValue);
if (FileExists(s_DownListPath))
File_ReadDownloadList(s_DownListPath);
}
}
public Action:Command_Reload(client, args)
{
if (FileExists(s_DownListPath))
File_ReadDownloadList(s_DownListPath);
return Plugin_Handled;
}