Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dialog Engine for Pawn

Include-only dialog system for SA-MP and open.mp. Declarative, modular and easy to drop into any gamemode.

Features

  • No plugins, no dependencies — pure Pawn includes.
  • Legacy compatible — keeps your old ShowPlayerDialog dialogs working.
  • Named dialogs — create dialogs once, show them anywhere by slot.
  • Multi-step chainsinline-dialogs.inc for registration, surveys, wizards.
  • Paginated listspaged-dialogs.inc splits long item lists into pages.
  • Declarative macrosdialog-macros.inc lets you write dialogs in separate files.
  • Optional extras — sscanf2 helpers (dialog-sscanf.inc) and SQLite persistence (dialog-persist.inc).
  • Debug logging — compile with #define DIALOG_ENGINE_DEBUG to trace dialog lifecycle.

Quick start

#define BASIC_DIALOGS_COUNT (1000)
#include "dialog-engine.inc"
#include "dialog-macros.inc"

DIALOG(WelcomeDialog)
{
    g_Dlg_WelcomeDialog = DialogCreate("welcome");
    DialogSetStyle(g_Dlg_WelcomeDialog, DIALOG_STYLE_MSGBOX);
    DialogSetTitle(g_Dlg_WelcomeDialog, "Welcome");
    DialogSetBody(g_Dlg_WelcomeDialog, "Hello! Ready to play?");
    DialogSetButtons(g_Dlg_WelcomeDialog, "Yes", "No");
    DialogSetHandler(g_Dlg_WelcomeDialog, "Dlg_WelcomeDialog_Response");
}

DIALOG_RESPONSE(WelcomeDialog)
{
    if (!response)
    {
        Kick(playerid);
        return 1;
    }
    SendClientMessage(playerid, 0x00FF00FF, "Welcome aboard!");
    return 1;
}

public OnGameModeInit()
{
    Dlg_Init_WelcomeDialog();
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/welcome", true))
    {
        SHOW_DLG(playerid,WelcomeDialog);
        return 1;
    }
    return 0;
}

Installation

  1. Copy the include/ folder contents into your project's include directory.
  2. Include the modules you need.
  3. Define BASIC_DIALOGS_COUNT before including dialog-engine.inc to reserve IDs for legacy dialogs.
#define BASIC_DIALOGS_COUNT (1000)
#include <dialog-engine>      // required
#include <inline-dialogs>     // optional
#include <paged-dialogs>      // optional
#include <dialog-macros>      // optional

Modules

File Purpose
dialog-engine.inc Core engine: dialog creation, dynamic IDs, handlers, timeouts, tags, bulk helpers.
inline-dialogs.inc Multi-step dialog chains with automatic next/previous navigation.
paged-dialogs.inc Paginated DIALOG_STYLE_LIST with built-in Next/Back items.
dialog-macros.inc DIALOG() / DIALOG_RESPONSE() macros for modular single dialogs.
dialog-sscanf.inc Optional sscanf2 macros and error helper.
dialog-persist.inc Optional SQLite persistence for dialog state.

Examples

  • examples/gamemode.pwn — minimal gamemode wiring a modular dialog.
  • examples/dialogs/login.pwn — reusable login dialog module.
  • tests/dialog-engine-test.pwn — full feature test suite.

Compilation

qawno/pawncc.exe tests/dialog-engine-test.pwn -otests/dialog-engine-test.amx -i"qawno/include" -i"include"

License

MIT see LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages