• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Plugin] Maxora
#1
Maxora
Highly optimized, zero-allocation MaxMind DB component for open.mp

Maxora is a production-ready component designed specifically for modern open.mp servers. It allows you to natively query MaxMind DB (.mmdb) databases directly from your Pawn scripts to instantly geolocate IPs (Country, City, ASN, ISP) without choking your main server thread.

Features
  • Extreme Performance: Uses Memory-Mapped I/O (MMDB_MODE_MMAP) for instant O(depth) lookups directly from the OS disk cache.
  • Zero Heap Allocations: Hot paths run exclusively on the C++ stack using fixed-size buffers and thread_local memory arrays. Performs 0 dynamic heap allocations per query.
  • Memory Safety Guarantee: Strictly enforces bounds checking and utilizes open.mp's native StringView to prevent buffer overflows during AMX string interactions.
  • Atomic Hot-Swaps: Reloads the database on the fly. If you provide an invalid file, the plugin gracefully rejects it while preserving the existing database, preventing live-server crashes.
  • Dynamic JSON-like Paths: Query any arbitrary depth hierarchy natively (e.g., "country.names.es").

Usage Example
Maxora comes with pre-made stock helpers to simplify common queries and supports up to 8 localized languages out of the box!

Code:
#include <open.mp>
#include <maxora>

main()
{
    // The .mmdb file should be in your server root directory
    if (MMDB_Load("GeoLite2-City.mmdb"))
    {
        print("Database loaded successfully!");
       
        new country[64], city[64];
        new const ip[] = "8.8.8.8";

        // Query localized Spanish country name instantly
        if (MMDB_GetCountryName(ip, country, sizeof(country), MMDB_LANG_SPANISH))
        {
            printf("Country (Spanish): %s", country);
        }

        if (MMDB_GetCityName(ip, city, sizeof(city), MMDB_LANG_ENGLISH))
        {
            printf("City (English): %s", city);
        }
        else
        {
            // Fully integrated internal error tracking
            new err[128];
            if (MMDB_GetLastError(err, sizeof(err)))
            {
                printf("Failed to get city: %s", err);
            }
        }
    }
}

Download & Installation
Requirements: open.mp server (Windows or Linux x86).
  1. Download the latest maxora.dll or libmaxora.so from the GitHub Releases Page.
  2. Place it in your open.mp components directory.
  3. Download a GeoLite2 Free Database and place it in the server root.
  4. Add maxora.inc to your pawno/include folder.

Source Code
Maxora is fully open-source and natively built against the modern IComponent open.mp SDK interface.
https://github.com/itskoleban/Maxora
  Reply


Forum Jump: