samp.directory
← Scripts y librerías

by-not/not_dialog_pages

Zero-dependency paginated dialog system (LIST, TABLIST, TABLIST_HEADERS) with packed memory storage for SA-MP and open.mp.

Librería★ 0actualizado ayerMITPawn
Abrir en GitHub
Probar en el compilador de Pawn →

Añade sus archivos include, con las librerías de las que depende, al compilador de Pawn de tu navegador, listos para incluirlos en un script.

README.md

not_dialog_pages

Language: English | Español

A lightweight, zero-dependency paginated dialog system for SA-MP and open.mp.

Features

  • Supports DIALOG_STYLE_LIST, DIALOG_STYLE_TABLIST, and DIALOG_STYLE_TABLIST_HEADERS.
  • Automatic pagination based on items_per_page and SA-MP's 4096-byte dialog size limit.
  • Packed (char) item buffer for low AMX memory usage.
  • Customizable Next / Back navigation items.
  • Clean DialogPages: callback macro with automatic global index resolution.
  • Zero external dependencies (requires only <a_samp>).

Installation

  1. Copy not_dialog_pages.inc to your pawno/include/ (or qawno/include/) folder.
  2. Include it after <a_samp>:
#include <a_samp>

// Optional configuration (define before including):
#define MAX_DIALOG_ITEMS         200
#define DIALOG_MAX_LISTITEM_SIZE 128
#define NDP_AUTO_REMOVE_NEW_LINE true
// #define NDP_DEBUG

#include <not_dialog_pages>

Quick Start

DialogPages:MyItems(playerid, response, listitem, inputtext[])
{
    if(!response) return 1;

    new msg[64];
    format(msg, sizeof(msg), "Selected item #%d: %s", listitem, inputtext);
    SendClientMessage(playerid, -1, msg);
    return 1;
}

stock ShowMyItems(playerid)
{
    ClearDialogListitems(playerid);
    for(new i = 0; i < 50; i++)
    {
        new row[32];
        format(row, sizeof(row), "Item #%d", i + 1);
        AddDialogListitem(playerid, row);
    }

    ShowPlayerDialogPages(playerid, "MyItems", DIALOG_STYLE_LIST,
        "Items List", "Select", "Close", 10);
}

API Reference

FunctionDescription
ClearDialogListitems(playerid)Clears the player's buffered items and pagination state.
AddDialogListitem(playerid, const itemstr[])Adds an item to the player's dialog buffer.
ShowPlayerDialogPages(...)Calculates pages and displays page 0 to the player.
GetDialogPage(playerid)Returns the current 0-based page index.
GetDialogItemsCount(playerid)Returns the total number of buffered items.
bool:IsDialogOpen(playerid)Returns true if a paginated dialog is currently open.
bool:SetDialogPage(playerid, page)Switches to a specific 0-based page while open.

Credits

  • Written and refactored by not.
  • Inspired by the original SA-MP Dialog-Pages library by Nickk888.

License

Released under the MIT License.

dialogsgtasaopenmppaginationpawnsamp

Esta página se genera con lo que GitHub publica sobre el repositorio. samp.directory no aloja el código. Informar de un problema con esta ficha

by-not/not_dialog_pages: Librería de SA-MP | samp.directory