Skip to content

Instantly share code, notes, and snippets.

@Y-Less
Last active October 23, 2019 15:50
Show Gist options
  • Save Y-Less/82dd4abbb5dda9b7fb6c8a0c35a14f97 to your computer and use it in GitHub Desktop.
Save Y-Less/82dd4abbb5dda9b7fb6c8a0c35a14f97 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, ... },
bool:gOPDR = true;
hook function ShowPlayerDialog(playerid, dialogid, style, const caption[], const info[], const button1[], const button2[])
{
gCur[playerid] = dialogid;
if (gOPDR)
gPrev[playerid] = INVALID_DIALOG_ID;
return continue(playerid, dialogid, style, caption, info, button1, button2);
}
stock GetPreviousDialog(playerid)
{
return 0 <= playerid < MAX_PLAYERS ? gPrev[playerid] : INVALID_DIALOG_ID;
}
hook public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
gOPDR = false;
gCur[playerid] = INVALID_DIALOG_ID;
continue(playerid, dialogid, response, listitem, inputtext);
gPrev[playerid] = (gCur[playerid] == INVALID_DIALOG_ID) ? INVALID_DIALOG_ID : dialogid;
gOPDR = true;
return 1;
}
hook public OnPlayerConnect(playerid)
{
gPrev[playerid] = gCur[playerid] = INVALID_DIALOG_ID;
continue(playerid);
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment