Skip to content

Instantly share code, notes, and snippets.

@Y-Less
Last active October 17, 2019 18:58
Show Gist options
  • Save Y-Less/b685ac671caf84f1f26a2cbe60ae42db to your computer and use it in GitHub Desktop.
Save Y-Less/b685ac671caf84f1f26a2cbe60ae42db to your computer and use it in GitHub Desktop.
#define INVALID_DIALOG_ID (cellmin)
static stock
gPrev[MAX_PLAYERS] = { INVALID_DIALOG_ID, ... },
gCur[MAX_PLAYERS] = { INVALID_DIALOG_ID, ... };
stock Prev_ShowPlayerDialog(playerid, dialogid, style, const caption[], const info[], const button1[], const button2[])
{
gCur[playerid] = dialogid;
return ShowPlayerDialog(playerid, dialogid, style, caption, info, button1, button2);
}
#if defined _ALS_ShowPlayerDialog
#undef ShowPlayerDialog
#else
#define _ALS_ShowPlayerDialog
#endif
#define ShowPlayerDialog Prev_ShowPlayerDialog
stock GetPreviousDialog(playerid)
{
return (0 <= playerid < MAX_PLAYERS) ? gPrev[playerid] : INVALID_DIALOG_ID;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
gCur[playerid] = INVALID_DIALOG_ID;
#if defined Prev_OnDialogResponse
Prev_OnDialogResponse(playerid, dialogid, response, listitem, inputtext);
#endif
gPrev[playerid] = (gCur[playerid] == INVALID_DIALOG_ID) ? INVALID_DIALOG_ID : dialogid;
return 1;
}
#if defined Prev_OnDialogResponse
forward Prev_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
#endif
#if defined _ALS_OnDialogResponse
#undef OnDialogResponse
#else
#define _ALS_OnDialogResponse
#endif
#define OnDialogResponse Prev_OnDialogResponse
public OnPlayerConnect(playerid)
{
gPrev[playerid] = gCur[playerid] = INVALID_DIALOG_ID;
#if defined Prev_OnPlayerConnect
Prev_OnPlayerConnect(playerid);
#endif
return 1;
}
#if defined Prev_OnPlayerConnect
forward Prev_OnPlayerConnect(playerid);
#endif
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect Prev_OnPlayerConnect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment