Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- === White_116 ================================
- Easy Dialogs Include
- 23.02.2013
- ================================= v1.0 =======
- 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);// Äîñòàíåì íàçâàíèå ôóíêöèè.
- if(funcidx(CurrentDialog) == -1)return 0;// Åñëè íåò ôóíêöèè - âûõîäèì.
- new itr=strlen(inputtext);
- if(itr == 0)return CallLocalFunction(CurrentDialog[playerid], "ddd", playerid, response, listitem);// Âûçîâèì ôóíêöèþ áåç òåêñòà.
- else
- {
- // -Stranger- --------------------------------------------------------
- for(itr--; itr > -1; itr--)//Ïîêà åñòü ñèìâîëû
- switch(inputtext[itr])
- {
- case 0x25: inputtext[itr]=0x23; // Ìåíÿåì '%' íà '#'.
- case 0x00 .. 0x1F: inputtext[itr]=0x3F; // Ìåíÿåì 'Óïðàâëÿþùèå ñèìâîëû' íà '?'.
- }
- //------------------------------------------------------------------------------
- return CallLocalFunction(CurrentDialog[playerid], "ddds", playerid, 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
Advertisement