Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- === White_116 ================================
- Easy Dialogs Include
- 27.02.2013
- ================================= v1.1 =======
- Is based on Easy Dialogs by Emmet_
- http://forum.sa-mp.com/showthread.php?t=377140
- ==============================================
- native HideDialog(playerid);
- native ShowDialog(playerid, dialog[], style, caption[], info[], button1[], button2[]);
- */
- #define Dialog:%0() forward dialog_%0(playerid, response, listitem, inputtext[]); public dialog_%0(playerid, response, listitem, inputtext[])
- //#define Show:<%0> #dialog_%0
- #define D: #dialog_
- forward HideDialog(playerid);
- public HideDialog(playerid)
- {
- DeletePVar(playerid, "CurrentDialog");// Очистим название функции.
- return ShowPlayerDialog(playerid, -1, 0, "", "", "", "");// Вызовим игроку диалог который закроет диалог.
- }
- forward ShowDialog(playerid, dialog[], style, caption[], info[], button1[], button2[]);
- public ShowDialog(playerid, dialog[], style, caption[], info[], button1[], button2[])
- {
- SetPVarString(playerid,"CurrentDialog",dialog);// Запишем название функции.
- return ShowPlayerDialog(playerid, random(256), style, caption, info, button1, button2);// Вызовим игроку диалог
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new CurrentDialog[32];// Переменая для хранения названия функции
- GetPVarString(playerid, "CurrentDialog", CurrentDialog, 32);// Достанем название функции.
- new itr=strlen(inputtext);// Узнаем количество символов
- if(itr == 0)// Если есть символы
- {
- if(strlen(CurrentDialog))// Если есть название функции.
- if(funcidx(CurrentDialog) != -1)// Если существует функция
- {
- DeletePVar(playerid, "CurrentDialog");// Очистим название функции.
- if(CallLocalFunction(CurrentDialog, "ddd", playerid, response, listitem))return 1;// Вызовим функцию без текста и выйдем
- }
- }
- else
- {
- // -Stranger- --------------------------------------------------------
- // http://forum.sa-mp.com/showpost.php?p=2282738&postcount=443
- for(itr--; itr > -1; itr--)// Пока есть символы
- switch(inputtext[itr])// Ищем символ
- {
- case 0x25: inputtext[itr]=0x23; // Меняем '%' на '#'.
- case 0x00 .. 0x1F: inputtext[itr]=0x3F; // Меняем 'Управляющие символы' на '?'.
- }
- //------------------------------------------------------------------------------
- if(strlen(CurrentDialog))// Если есть название функции.
- if(funcidx(CurrentDialog) != -1)// Если существует функция
- {
- DeletePVar(playerid, "CurrentDialog");// Очистим название функции.
- if(CallLocalFunction(CurrentDialog, "ddds", playerid, response, listitem, inputtext))return 1;// Вызовим функцию с текстом и выйдем
- }
- }
- return W_OnDialogResponse(playerid, dialogid, response, listitem, inputtext);// Вызовим стандартный паблик (Уже подменён)
- }
- #if defined _ALS_OnDialogResponse
- #undef OnDialogResponse
- #else
- #define _ALS_OnDialogResponse
- #endif
- #define OnDialogResponse W_OnDialogResponse
- forward W_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
- //************************** EOS ********************************
Advertisement
Add Comment
Please, Sign In to add comment