04.11.2011, 01:07
(
Последний раз редактировалось BigETI; 05.11.2011 в 16:42.
)
What does this include actually do?
It does actually call a function with a higher performance instead of using any checks inside OnDialogResponse.
How to use this include?
Simple we can use
or
or (not recommend)
Callback start:
Dialog Response ID:
Player ID
Response statement
List item ID:
Inputtext string:
Example:
Every function must return a value. (Returning 1 or higher will stop calling OnDialogResponse otherwise returning 0 will call OnDialogResponse.)
Of course you can use several dialog responses to run another dialog response ID callbacks
Example:
Benchmark Scripts/Results:
Every single callback/check will be called. Loops 10000 times through:
Edit: Because I was dumb enough to call the dialog response ID correctly, I have to retest the speed + reupload the scripts
Credits:
Download bdial.inc from Solidfiles
Download bdial.inc from Pastebin
Regards: BigETI
It does actually call a function with a higher performance instead of using any checks inside OnDialogResponse.
How to use this include?
Simple we can use
pawn Код:
DIAL:0(playerid, bool:response, listitem, inputtext[])
pawn Код:
DIALOG:0(playerid, bool:response, listitem, inputtext[])
pawn Код:
forward dial_0(playerid, bool:response, listitem, inputtext[]);
public dial_0(playerid, bool:response, listitem, inputtext[])
//...
Код:
DIAL:0(playerid, bool:response, listitem, inputtext[])
Код:
DIAL:
Код:
0
Код:
playerid
Код:
bool:response
Код:
listitem
Код:
inputtext[]
pawn Код:
DIAL:5(playerid, bool:response, listitem, inputtext[])
{
if(response) SendClientMessage(playerid, 0x00FF00FF, "You have accepted the rules.");
else SendClientMessage(playerid, 0xFF0000FF, "You have declined the rules.");
return 1;
}
Of course you can use several dialog responses to run another dialog response ID callbacks
Example:
pawn Код:
DIAL:5(playerid, bool:response, listitem, inputtext[])
{
if(response) SendClientMessage(playerid, 0x00FF00FF, "You have accepted the rules.");
else SendClientMessage(playerid, 0xFF0000FF, "You have declined the rules.");
return 1;
}
DIAL:1(playerid, bool:response, listitem, inputtext[]) return dial_5(playerid, response, listitem, inputtext);
DIAL:2(playerid, bool:response, listitem, inputtext[]) return dial_5(playerid, response, listitem, inputtext);
//etc..
Every single callback/check will be called. Loops 10000 times through:
Edit: Because I was dumb enough to call the dialog response ID correctly, I have to retest the speed + reupload the scripts
- bdial.inc: 123ms - 125ms (not bad for such loop)
- fdialog.inc: 123ms- 124ms (kinda fast as my include)
- gDialog.inc: 175ms - 178ms (abit slower than bdial.inc and fdialog.inc, but still fast)
- if else methode: 1736ms - 1759ms (SLOW!)
- switch methode: 125ms - 127ms (This impressed me because the switch methode is also very fast. [But some milliseconds slower than bdial.inc and fdialog.inc. :P ])
Credits:
- Myself..
- Idea from ZCMD include which also calls a callback instead of using checks in its own callback
- Hooking methode by ******
- SA:MP Development Team
Download bdial.inc from Solidfiles
Download bdial.inc from Pastebin
Regards: BigETI