on player showed new dialog
#1

Hi,

Is there callback how to know when i show player dialog?
Reply
#2

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.
Reply
#3

How to hook, that i don't need to replace all showplayerdialog ? to something
Reply
#4

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).
Reply
#5

#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?
Reply
#6

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)
{
}
Reply
#7

OnPlayerDialogShown

When this will by called?
Reply
#8

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
Reply
#9

But it really don't undefind my other showplayerdialog if there are?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)