Skip to content

env_samp

Environment variables (.env) plugin for SA-MP and Open Multiplayer, written entirely in Rust. Loads a .env file at startup and exposes its values to Pawn through a single typed native.

The same .so / .dll runs on SA-MP and on Open Multiplayer — natively as a component (recommended) or via legacy mode. See Installation for both registration paths.

Where to start

Goal Path
First time here Installation → Usage
Learning the file syntax .env format
Quick lookup API reference

Minimal example

#include <a_samp>
#include <env_samp>

public OnGameModeInit()
{
    new host[64];
    if (Env("MYSQL_HOST", host))
    {
        printf("[env_samp] MYSQL_HOST=%s", host);
    }

    new port;
    if (Env("MYSQL_PORT", port, ENV_INT))
    {
        printf("[env_samp] MYSQL_PORT=%d", port);
    }

    return 1;
}