samp.directory
← Skrypty i biblioteki

by-not/not_dialog_pages

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

Biblioteka★ 0zaktualizowano wczorajMITPawn
Otwórz na GitHubie
Wypróbuj w kompilatorze Pawn →

Dodaje jej pliki include, razem z bibliotekami, od których zależy, do kompilatora Pawn w twojej przeglądarce, gotowe do dołączenia w skrypcie.

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

Ta strona jest zbudowana z tego, co GitHub publikuje o repozytorium. samp.directory nie hostuje kodu. Zgłoś problem z tym wpisem

by-not/not_dialog_pages: Biblioteka SA-MP | samp.directory