Добро пожаловать на Pro Pawn - Портал о PAWN-скриптинге.
Страница 3 из 3 ПерваяПервая 1 2 3
Показано с 21 по 22 из 22

Тема: mdialog

  1. #21
    Аватар для MassonNN
    Пользователь

    Статус
    Оффлайн
    Регистрация
    16.03.2018
    Адрес
    Москва
    Сообщений
    129
    Репутация:
    6 ±
    хорошая и простая реализация, гораздо лучше аналогов

  2. #22
    Аватар для punkochel
    Пользователь

    Статус
    Оффлайн
    Регистрация
    08.12.2018
    Адрес
    Россия
    Сообщений
    146
    Репутация:
    25 ±
    Начиная с версии 1.4.0 в моде появляется рекурсия
      Открыть/закрыть
    PHP код:
    recursion detected: function Dialog_Close indirectly calls itself:
    Dialog_Close <- MDialog_ShowPlayerDialog <- Dialog_Close
    recursion detected
    : function Dialog_Interrupt indirectly calls itself:
    Dialog_Interrupt <- Dialog_Close <- MDialog_ShowPlayerDialog <- Dialog_Interrupt
    recursion detected
    : function Dialog_IsOpen indirectly calls itself:
    Dialog_IsOpen <- FIXES_OnDialogResponse <- Dialog_IsOpen
    recursion detected
    : function FIXES_ShowPlayerDialog indirectly calls itself:
    FIXES_ShowPlayerDialog <- MDialog_ShowPlayerDialog <- Dialog_Close <- FIXES_ShowPlayerDialog
    recursion detected
    : function FIXES_strcmp directly calls itself
    recursion detected
    : function MDialog_ShowPlayerDialog indirectly calls itself:
    MDialog_ShowPlayerDialog <- Dialog_Close <- MDialog_ShowPlayerDialog 
    На new.pwn результат тот-же, за исключением:
    PHP код:
    recursion detected: function FIXES_ShowPlayerDialog indirectly calls itself:
    FIXES_ShowPlayerDialog <- MDialog_ShowPlayerDialog <- Dialog_Close <- FIXES_ShowPlayerDialog
    recursion detected
    : function FIXES_strcmp directly calls itself 

    При всем при этом не работает вызов DialogInterrupt:
    PHP код:
    CMD:test(playerid)
    {
            
    SendClientMessage(id, -1mes);*/
            
    Dialog_Show(playeridDialog:test);
            return 
    1;
    }
    DialogCreate:test(playerid)
    {
        
    Dialog_Open(playeridDialog:testDIALOG_STYLE_MSGBOX,
                    
    "Hello",
                    
    "Are you ok?",
                    
    "Yes""No");
    }

    DialogResponse:test(playeridresponselistiteminputtext[])
    {
        if (!
    response) {
            
    SendClientMessage(playerid, -1"This club only for OK guys!");
            return 
    1;
        }

        
    SendClientMessage(playerid, -1"Welcome to the club");
        return 
    1;
    }

    DialogInterrupt:test(playerid)
    {
        
    SendClientMessage(playerid, -1"Dialog \"test\" was closed by Dialog_Close or by opening other dialog");
        return 
    1;



    UPD:

    Решение проблемы с рекурсией:

    Было:
      Открыть/закрыть
    1. stock MDialog_ShowPlayerDialog(playerid, dialogid, style, const caption[], const info[], const button1[], const button2[])
    2. {
    3. if (dialogid != -1 && dialogid != MDIALOG_DIALOG_ID) {
    4. if (Dialog_IsOpen(playerid, gDialogFunction[playerid])) {
    5. Dialog_Close(playerid, gDialogFunction[playerid][4], false);
    6. }
    7. }
    8.  
    9. return ShowPlayerDialog(playerid, dialogid, style, caption, info, button1, button2);
    10. }
    11. #if defined _ALS_ShowPlayerDialog
    12. #undef ShowPlayerDialog
    13. #else
    14. #define _ALS_ShowPlayerDialog
    15. #endif
    16.  
    17. #define ShowPlayerDialog MDialog_ShowPlayerDialog


    Стало:
      Открыть/закрыть
    1. stock MDialog_ShowPlayerDialog(playerid, dialogid, style, const caption[], const info[], const button1[], const button2[])
    2. {
    3. if (dialogid != -1 && dialogid != MDIALOG_DIALOG_ID) {
    4. if (Dialog_IsOpen(playerid, gDialogFunction[playerid][4])) {
    5. Dialog_Interrupt(playerid, gDialogFunction[playerid][4]);
    6. }
    7. }
    8.  
    9. return ShowPlayerDialog(playerid, dialogid, style, caption, info, button1, button2);
    10. }
    11. #if defined _ALS_ShowPlayerDialog
    12. #undef ShowPlayerDialog
    13. #else
    14. #define _ALS_ShowPlayerDialog
    15. #endif
    16.  
    17. #define ShowPlayerDialog MDialog_ShowPlayerDialog


    Решение проблемы с неработоспособностью DialogInterrupt:

    Было:
      Открыть/закрыть
    1. static stock _Dialog_Open(playerid, const function[], style, const caption[], const info[], const button1[], const button2[])
    2. {
    3. if (Dialog_IsOpen(playerid, gDialogFunction[playerid])) {
    4. Dialog_Interrupt(playerid, gDialogFunction[playerid][4]);
    5. }
    6.  
    7. gIsDialogOpen{playerid} = true;
    8.  
    9. gDialogFunction[playerid] = "dre_";
    10. strcat(gDialogFunction[playerid], function, sizeof(gDialogFunction[]));
    11.  
    12. switch (style) {
    13. case DIALOG_STYLE_MSGBOX, DIALOG_STYLE_INPUT, DIALOG_STYLE_PASSWORD: {
    14. #if defined MDIALOG_DISABLE_TAGS
    15. return ShowPlayerDialog(playerid, MDIALOG_DIALOG_ID, style, caption, info, button1, button2);
    16. #else
    17. static info_result[MDIALOG_MAX_INFO_SIZE];
    18. _MDialog_ProcessTags(info, info_result);
    19. return ShowPlayerDialog(playerid, MDIALOG_DIALOG_ID, style, caption, info_result, button1, button2);
    20. #endif
    21. }
    22. }
    23.  
    24. return ShowPlayerDialog(playerid, MDIALOG_DIALOG_ID, style, caption, info, button1, button2);
    25. }


    Стало:
      Открыть/закрыть
    1. static stock _Dialog_Open(playerid, const function[], style, const caption[], const info[], const button1[], const button2[])
    2. {
    3. gIsDialogOpen{playerid} = true;
    4. if (Dialog_IsOpen(playerid, gDialogFunction[playerid][4])) {
    5. Dialog_Interrupt(playerid, gDialogFunction[playerid][4]);
    6. }
    7.  
    8. gDialogFunction[playerid] = "dre_";
    9. strcat(gDialogFunction[playerid], function, sizeof(gDialogFunction[]));
    10.  
    11. switch (style) {
    12. case DIALOG_STYLE_MSGBOX, DIALOG_STYLE_INPUT, DIALOG_STYLE_PASSWORD: {
    13. #if defined MDIALOG_DISABLE_TAGS
    14. return ShowPlayerDialog(playerid, MDIALOG_DIALOG_ID, style, caption, info, button1, button2);
    15. #else
    16. static info_result[MDIALOG_MAX_INFO_SIZE];
    17. _MDialog_ProcessTags(info, info_result);
    18. return ShowPlayerDialog(playerid, MDIALOG_DIALOG_ID, style, caption, info_result, button1, button2);
    19. #endif
    20. }
    21. }
    22.  
    23. return ShowPlayerDialog(playerid, MDIALOG_DIALOG_ID, style, caption, info, button1, button2);
    24. }


    PS: Дорабатывалась версия mdialog v1.4.1
    Последний раз редактировалось punkochel; 10.06.2020 в 10:52.

 

 
Страница 3 из 3 ПерваяПервая 1 2 3

Информация о теме

Пользователи, просматривающие эту тему

Эту тему просматривают: 1 (пользователей: 0 , гостей: 1)

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •