Код
#pragma semicolon 1
#include <sourcemod>
public OnPluginStart()
{
LoadTranslations("ov_downloadfilter.phrases");
}
public OnMapStart()
{
new Handle:kv = CreateKeyValues("Phrases");
new String:buffer[PLATFORM_MAX_PATH];
BuildPath(Path_SM, buffer, sizeof(buffer), "translations/ov_downloadfilter.phrases.txt");
if (!FileToKeyValues(kv, buffer))
{
KvJumpToKey(kv, "downloadfilter", true);
KvSetString(kv, "en", "Change download filter to (Allow all custom files from server)");
KvSetString(kv, "ru", "Change download filter to (Allow all custom files from server)");
KvRewind(kv);
KeyValuesToFile(kv, buffer);
}
CloseHandle(kv);
}
public OnClientPutInServer(client)
{
QueryClientConVar(client, "cl_downloadfilter", CLDownloadFilter, client);
}
public CLDownloadFilter(QueryCookie:cookie, client, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[])
{
if (result == ConVarQuery_Okay)
{
if (strcmp(cvarValue, "all", false) != 0)
{
decl String:stext[192]; stext[0] = '\0';
Format(stext, sizeof(stext), "%T", "downloadfilter", client);
KickClient(client, stext);
}
}
}
ещё
Код
#include <sourcemod>
public OnClientPostAdminCheck(client)
{
QueryClientConVar(client, "cl_downloadfilter", ConVarQueryFinished:ClientConVar, client);
}
public ClientConVar(QueryCookie:cookie, client, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[])
{
if (StrEqual(cvarValue, "all")) return true;
else KickClient(client, "Включите переменную %s all", cvarName);
return true;
}