Skip to content
This repository was archived by the owner on Sep 26, 2021. It is now read-only.

Requests Plugin Listing

Barnaby Keene edited this page Jan 23, 2019 · 4 revisions

You can list your server by simply posting the IP on https://samp-servers.net

However, you can take advantage of additional features such as a banner image, description and custom rules fields by posting directly from your server.

This can be done easily with Southclaws/pawn-requests

new RequestsClient:MasterlistClient;

forward MasterlistUpdate();

public OnGameModeInit() {
    MasterlistClient = RequestsClient("https://api.samp-servers.net");
    SetTimer("MasterlistUpdate", 5000, true);
}

public MasterlistUpdate() {
    new playerCount;

    for(new i; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
            playerCount++;
        }
    }

    RequestJSON(
        MasterlistClient,
        "/v2/server/123.45.67.89:7777", // replace 123.45.67.89 with your IP
        HTTP_METHOD_POST,
        "",
        JsonObject(
            "core", JsonObject(
                "ip", JsonString("123.45.67.89:7777"), // replace 123.45.67.89 with your IP
                "hn", JsonString("HOSTNAME GOES HERE"),
                "pc", JsonInt(playerCount),
                "pm", JsonInt(MAX_PLAYERS),
                "gm", JsonString("GAMEMODE NAME GOES HERE"),
                "la", JsonString("LANGUAGE GOES HERE"),
                "pa", JsonBool(false)
            ),
            "ru", JsonObject(
                "weburl", JsonString("samp-lsgw.com"),
                "discord", JsonString("https://discord.gg/hURGKHJ"),
                "teamspeak", JsonString("ts.example.com")
            ),
            "description", JsonString("Description of your server"),
            "banner", JsonString("A link to a .jpg or .png banner image")
        )
    );
}

Clone this wiki locally