Advertisement
roach_

RDLG - Reliable/Fast Dialog Processor | Faster/Shorter

Feb 19th, 2012
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.83 KB | None | 0 0
  1. /*
  2.             .................................
  3.             RDLG
  4.               Reliable/Fast Dialog Processor
  5.             .................................
  6.              
  7. Description:
  8.     This is a little include that uses OnPlayerDialogResponse( ) to process players Dialogs.
  9.     Each dialog has his own function like the Command Processors( ZCMD, DCMD, YCMD ),
  10.     such method is much faster than the normal way.
  11.  
  12. License:
  13.     The contents of this file are subject to the Mozilla Public License Version
  14.     1.1 (the "License"); you may not use this file except in compliance with
  15.     the License. You may obtain a copy of the License at
  16.     http://www.mozilla.org/MPL/
  17.  
  18. */
  19. #tryinclude <YSI\y_hooks>
  20.  
  21. #if defined _rdlg_included
  22.     #endinput
  23. #endif
  24. #define _rdlg_included
  25.  
  26. #define DIALOG:%1(%2)                       \
  27.             forward dlg_%1(%2);             \
  28.             public dlg_%1(%2)
  29.            
  30. #define DLG:%1(%2)                          \
  31.             DIALOG:%1(%2)
  32.  
  33. #if !defined isnull
  34.     #define isnull(%1)                      \
  35.             ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
  36. #endif
  37.  
  38. new  s_g_Dialog[ 25 ];
  39.  
  40. #if defined _INC_y_hooks
  41.     Hook:RDLG_OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
  42. #else
  43.     public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
  44. #endif
  45. {
  46.     new _D[ 10 ]; valstr( _D, dialogid, true );
  47.     strcat( s_g_Dialog, "dlg_" );
  48.     strcat( s_g_Dialog, _D );
  49.    
  50.     //if( inputtext[ 0 ] == '\0' ) return CallLocalFunction( s_g_Dialog, "iiis", playerid, response, listitem, "\1" ); 
  51.    
  52.     return CallLocalFunction( s_g_Dialog, "iiis", playerid, response, listitem, ( inputtext[ 0 ] == '\0' ) ? ( "\1" ) : ( inputtext ) );
  53. }
  54.  
  55. #if !defined _INC_y_hooks
  56.     #if defined _ALS_OnDialogResponse
  57.         #undef OnDialogResponse
  58.     #else
  59.         #define _ALS_OnDialogResponse
  60.     #endif
  61.     #define OnDialogResponse rdlg_OnDialogResponse
  62.     forward rdlg_OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] );
  63. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement