18.02.2012, 12:00
(
Последний раз редактировалось aRoach; 19.02.2012 в 06:27.
)
Description
That's all! Very easy, isn't it?
How to make two different dialogs doing the same thing( like in ZCMD )
- This is a little include that uses OnPlayerDialogResponse( ) to process players Dialogs.
Each dialog has his own function like the Command Processors( ZCMD, DCMD, YCMD ), such method is much faster than the normal way.
- All you need to do is to add a public function using special pre-defined macros, like this:
or( another macro ):pawn Код:DIALOG:1( playerid, response, listitem, inputtext[ ] )
{
// Your code here, like in the Normal Dialogs with 'if else if else if else'
return ( 1 ); // My style, it's not obligatory to use returns like that
}
pawn Код:DLG:1( playerid, response, listitem, inputtext[ ] )
{
// Your code here, like in the Normal Dialogs with 'if else if else if else'
return ( 1 );
}
That's all! Very easy, isn't it?
How to make two different dialogs doing the same thing( like in ZCMD )
- For example, you have the dialog '123' :
And you want to create another one that does the same thing:pawn Код:DIALOG:123( playerid, response, listitem, inputtext[ ] )
{
// Your stuff here...
return ( 1 );
}
pawn Код:DIALOG:456( playerid, response, listitem, inputtext[ ] )
{
return dlg_123( playerid, response, listitem, inputtext );
}
- If you want to check whether inputtext string is empty( like in ZCMD with parameters ) you should not do it like:
or:pawn Код:if( !strlen( inputtext ) )
{
// ...
}
Just use isnull( ), because its length will never be NULL:pawn Код:if( !inputtext[ 0 ] )
{
// ...
}
Actually, if you use sscanf[1] you don't need to do this as it has built-in isnull checking.pawn Код:if( isnull( inputtext ) )
{
// ...
}
- I did the test between mine and FDLG( because I think is the faster ) and here's the Result:
Both are almost the same at timing!Код:Time taken to show 32766 RDLG dialogs: 3 ms, average call time: 3/32766 ms. Time taken to execute 100,000,000 RDLG OnDialogResponse calls: 8805 ms. Time taken to show 32766 FDLG dialogs: 4 ms, average call time: 4/32766 ms. Time taken to execute 100,000,000 FDLG OnDialogResponse calls: 8818 ms.
- You'll need y_hooks( OPTIONAL ).
- ****** - For some Tips.
- stuntman - For some Tips.
- Gamer_Z - His Speed Test Filterscript.



Good Job!