Иконка ресурса

Environment Variables 1.0.0.2

Нет прав для скачивания
Расширение для получения переменных среды окружения
Поддерживаемые игры
  1. CS: Source (OrangeBox)
  2. CS: GO
  3. Team Fortress 2
  4. DOD: Source
  5. Left 4 Dead (L4D/L4D2)
Простое расширение, пробрасывающее вызовы к getenv() для возможности работы с переменными среды окружения (такими как PATH, HOME и пр.).
Писалось изначально для себя, как вспомогательный плагин для системы управления серваками, но это уже совсем другая история.

Код:
Expand Collapse Copy
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Environment Variables
* Copyright (C) 2020 CrazyHackGUT aka Kruzya.  All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program.  If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation.  You must obey the GNU General Public License in
* all respects for all other code used.  Additionally, AlliedModders LLC grants
* this exception to all derivative works.  AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#include <sourcemod>
#include <env_variables>

public void OnPluginStart()
{
    EmptyLines(10);

    char szValue[256];
    PrintToServer("Testing getting variables...");

    RunEnvironmentVariableCase("PATH", szValue, sizeof(szValue));
    RunEnvironmentVariableCase("SOURCEMOD", szValue, sizeof(szValue));
    RunEnvironmentVariableCase("METAMOD", szValue, sizeof(szValue));

    EmptyLines(10);
}

void RunEnvironmentVariableCase(const char[] szName, char[] szBuffer, int iBufferLength)
{
    szBuffer[0] = 0;

    int iLength = GetEnvironmentVariable(szName, szBuffer, iBufferLength);
    PrintToServer("%%%s%% (%d bytes) = %s", szName, iLength, szBuffer);
}

void EmptyLines(int iCount)
{
    for (int i = 0; i < iCount; ++i)
    {
        EmptyLine();
    }
}

void EmptyLine()
{
    PrintToServer(" ");
}
Требования
SourceMod 1.10 и выше.
Установка
Скачать архив под свою платформу, распаковать в папку сервера.
Автор
hirowatch
Скачивания
0
Просмотры
186
Первый выпуск
Обновление

Оценки

0.00 звёзд 0 оценок

Последние обновления

  1. Обновление до 1.0.0.2

    Добавлена возможность устанавливать переменные среды окружения (SetEnvironmentVariable())...
Назад
Сверху Снизу