on player showed new dialog -
MerryDeer - 24.08.2016
Hi,
Is there callback how to know when i show player dialog?
Re: on player showed new dialog -
Gammix - 24.08.2016
Hook ShowPlayerDialog and add:
pawn Код:
#if defined OnPlayerDialogShown
OnPlayerDialogShown(playerid, dialogid);
#endif
Or use this code everytime you show a dialog, but i guess it is what you are resisting form.
Re: on player showed new dialog -
MerryDeer - 24.08.2016
How to hook, that i don't need to replace all showplayerdialog ? to something
Re: on player showed new dialog -
Gammix - 24.08.2016
https://sampforum.blast.hk/showthread.php?tid=570910
No you just need to hook ShowPlayerDialog on top (means before you have used any ShowPlayerDialog in the script).
Re: on player showed new dialog -
MerryDeer - 24.08.2016
#if defined _ALS_ShowPlayerDialog
#undef ShowPlayerDialog
#else
#define _ALS_ShowPlayerDialog
#endif
// Reroute future calls to our function.
#define ShowPlayerDialog MyLib_ShowPlayerDialog
That?
And if i use that method in includes there work showplayerdialog or not?
Re: on player showed new dialog -
Gammix - 24.08.2016
Yes, you can actually add this after <a_samp>.
pawn Код:
#include <a_samp>
// your hook here
stock MyLib_ShowPlayerDialog(..)
{
}
#if defined _ALS_ShowPlayerDialog
#undef ShowPlayerDialog
#else
#define _ALS_ShowPlayerDialog
#endif
// Reroute future calls to our function.
#define ShowPlayerDialog MyLib_ShowPlayerDialog
#include <other includes...>
// somewhere in the script
forward OnPlayerDialogShown(playerid);
public OnPlayerDialogShown(playerid)
{
}
Re: on player showed new dialog -
MerryDeer - 24.08.2016
OnPlayerDialogShown
When this will by called?
Re: on player showed new dialog -
Gammix - 24.08.2016
Quote:
Originally Posted by MerryDeer
OnPlayerDialogShown
When this will by called?
|
When you show a dialog, you see what hooking does is let you add your custom code into the function. So if you add the following code and then call ShowPlayerDialog from there, it will be called and then dialog will be shown.
pawn Код:
stock MyLib_ShowPlayerDialog(..params..)
{
#if defined OnPlayerDialogShown
OnPlayerDialogShown(playerid, dialogid);
#endif
return ShowPlayerDialog(..params..);
}
#if defined _ALS_ShowPlayerDialog
#undef ShowPlayerDialog
#else
#define _ALS_ShowPlayerDialog
#endif
#define ShowPlayerDialog MyLib_ShowPlayerDialog
Re: on player showed new dialog -
MerryDeer - 24.08.2016
But it really don't undefind my other showplayerdialog if there are?