Advertisement
Guest User

Easy Gialogs v1.0 By White_116

a guest
Feb 22nd, 2013
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.71 KB | None | 0 0
  1. /*
  2. === White_116 ================================
  3.             Easy Dialogs Include
  4.                 23.02.2013
  5. ================================= v1.0 =======
  6.     Is based on Easy Dialogs by Emmet_
  7.     http://forum.sa-mp.com/showthread.php?t=377140
  8. ==============================================
  9. native HideDialog(playerid);
  10. native ShowDialog(playerid, dialog[], style, caption[], info[], button1[], button2[]);
  11. */
  12. #define Dialog:%0() forward dialog_%0(playerid, response, listitem, inputtext[]); public dialog_%0(playerid, response, listitem, inputtext[])
  13. //#define Show:<%0> #dialog_%0
  14. #define D: #dialog_
  15.  
  16. forward HideDialog(playerid);
  17. public HideDialog(playerid)
  18. {
  19.     DeletePVar(playerid, "CurrentDialog");// Î÷èñòèì íàçâàíèå ôóíêöèè.
  20.     return ShowPlayerDialog(playerid, -1, 0, "", "", "", "");// Âûçîâèì èãðîêó äèàëîã êîòîðûé çàêðîåò äèàëîã.
  21. }
  22.  
  23. forward ShowDialog(playerid, dialog[], style, caption[], info[], button1[], button2[]);
  24. public ShowDialog(playerid, dialog[], style, caption[], info[], button1[], button2[])
  25. {
  26.     SetPVarString(playerid,"CurrentDialog",dialog);// Çàïèøåì íàçâàíèå ôóíêöèè.
  27.     return ShowPlayerDialog(playerid, random(256), style, caption, info, button1, button2);// Âûçîâèì èãðîêó äèàëîã
  28. }
  29.  
  30. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  31. {
  32.     new CurrentDialog[32];
  33.     GetPVarString(playerid, "CurrentDialog", CurrentDialog, 32);// Äîñòàíåì íàçâàíèå ôóíêöèè.
  34.     if(funcidx(CurrentDialog) == -1)return 0;// Åñëè íåò ôóíêöèè - âûõîäèì.
  35.     new itr=strlen(inputtext);
  36.     if(itr == 0)return CallLocalFunction(CurrentDialog[playerid], "ddd", playerid, response, listitem);// Âûçîâèì ôóíêöèþ áåç òåêñòà.
  37.     else
  38.     {
  39. //      -Stranger-      --------------------------------------------------------
  40.         for(itr--; itr > -1; itr--)//Ïîêà åñòü ñèìâîëû
  41.         switch(inputtext[itr])
  42.         {
  43.             case 0x25: inputtext[itr]=0x23; // Ìåíÿåì '%' íà '#'.
  44.             case 0x00 .. 0x1F: inputtext[itr]=0x3F; // Ìåíÿåì 'Óïðàâëÿþùèå ñèìâîëû' íà '?'.
  45.         }
  46. //------------------------------------------------------------------------------
  47.         return CallLocalFunction(CurrentDialog[playerid], "ddds", playerid, response, listitem, inputtext);// Âûçîâèì ôóíêöèþ ñ òåêñòîì.
  48.     }
  49. }
  50.  
  51. #if defined _ALS_OnDialogResponse
  52.     #undef OnDialogResponse
  53. #else
  54.     #define _ALS_OnDialogResponse
  55. #endif
  56. #define OnDialogResponse W_OnDialogResponse
  57.  
  58. forward W_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
  59. //**************************        EOS         ********************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement