samp.directory
← Scripts and libraries

devbluen/Dynamic-Dialog-Samp

Create and configure your dialog in a completely dynamic way.

Library★ 2updated 25 days agoNo licencePawnsampctl
Open on GitHub

This repository has no licence file. It is public to read, but that alone does not give permission to reuse it.

Install with sampctl

sampctl package install devbluen/Dynamic-Dialog-Samp

Run this in your project folder. sampctl downloads the package and what it depends on.

Try it in the Pawn compiler →

Adds its include files, with the libraries it depends on, to the Pawn compiler in your browser, ready to include in a script.

README.md

🫧 Dynamic Dialog - System

Create options in your Dialog in a more simplified and dynamic way.

📜 How to install?

⚙️ Functions

  • DialogDynamic_Create(playerid, DIALOG_STYLE:style, const title[], const button1[], const button2[], Func:inlineCreate, const callback[]);
  • DialogDynamic_Add(playerid, id, const body[], {Float, _}:...);

📝 Usage Examples

enum {
    E_INTERACTION_PRIVATE_OPTION,
    E_INTERACTION_PRIVATE_OPTION_LEVEL,
    E_INTERACTION_TEST1,
    E_INTERACTION_TEST2,
    E_INTERACTION_TEST3,
E_INTERACTION_TEST4
};

public OnPlayerConnect(playerid) {

    inline DialogDynamicCreate() {

        new
            page = 1,
            pages = 2
        ;

        if(Player_IsAdmin(playerid))
            DialogDynamic_Add(playerid, E_INTERACTION_PRIVATE_OPTION, "Private Option");

        if(Player_GetLevel(playerid) >= 5)
            DialogDynamic_Add(playerid, E_INTERACTION_PRIVATE_OPTION_LEVEL, "Private Option by level");

        DialogDynamic_Add(playerid, E_INTERACTION_TEST1, "test1");
        DialogDynamic_Add(playerid, E_INTERACTION_TEST2, "test2");
        DialogDynamic_Add(playerid, E_INTERACTION_TEST3, "test3");
        DialogDynamic_Add(playerid, E_INTERACTION_TEST4, "%d/%d", page, pages);
    }

    DialogDynamic_Create(playerid, DIALOG_STYLE_TABLIST, "dynamicDialog", "Select", "Close", using inline DialogDynamicCreate, "DialogDynamicResponse");
    return true;
}

DialogDynamic:DialogDynamicResponse(playerid, response, listitem, inputtext[]) {

    if(response) {
        switch(listitem) {
            case E_INTERACTION_PRIVATE_OPTION: SendClientMessage(playerid, -1, "This is a private option.");
            case E_INTERACTION_PRIVATE_OPTION_LEVEL: SendClientMessage(playerid, -1, "This is a private option by level");
            case E_INTERACTION_TEST1: SendClientMessage(playerid, -1, "Selected Test 1");
            case E_INTERACTION_TEST2: SendClientMessage(playerid, -1, "Selected Test 2");
            case E_INTERACTION_TEST3: SendClientMessage(playerid, -1, "Selected Test 3");
            case E_INTERACTION_TEST4: SendClientMessage(playerid, -1, "Selected Test 4");
        }
    }
    return true;
}

🍪 Dependencies

This page is built from what GitHub publishes about the repository. samp.directory does not host the code. Report a problem with this listing

devbluen/Dynamic-Dialog-Samp: SA-MP Library | samp.directory