samp.directory
← Skrypty i biblioteki

devbluen/Dynamic-Dialog-Samp

Create and configure your dialog in a completely dynamic way.

Biblioteka★ 2zaktualizowano 6 dni temuBrak licencjiPawnsampctl
Otwórz na GitHubie

To repozytorium nie ma pliku licencji. Jest publiczne do odczytu, ale samo to nie daje pozwolenia na ponowne użycie.

Zainstaluj za pomocą sampctl

sampctl package install devbluen/Dynamic-Dialog-Samp

Uruchom to w folderze swojego projektu. sampctl pobiera pakiet i to, od czego zależy.

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

🫧 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

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

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