[Include] NDIALOG-PAGES - Split dialog lists into multiple pages!
#1



About Include:
NDialog-Pages is basically an addon that adds 3 additional options to the "ShowPlayerDialog" function. It will add a feature so that you can split the dialog list into multiple pages!
It will basically calculate how many items will fit into one page and generate the "Next" button if there are too many. It will also add a "Back" button if you go to the second page etc. It will calculate the "listitem" in such way, like a normal list would work, so you don't need to make some calculation yourself, everything is automatic and it will return the correct "listitem".
It is VERY easy to use, because everything is fully automatic.

Features:
  • Adds 3 new parameters to "ShowPlayerDialog"
  • Easy to use!
  • Fully customable.
  • Fully automatic, no need to script page change.
Functions:
Code:
AddDialogListitem(playerid, const itemstring[]);
Code:
ClearDialogListitems(playerid);
Code:
ShowPlayerDialog(playerid, dialogid, style, caption[], #, button1[], button2[], items_per_page = 0, nextbutton[] = "{FF0000}>>>", backbutton[] = "{FF0000}<<<");
Parameters:
Code:
items_per_page - Items inside a page
nextbutton[] - "Next" button string
backbutton[] - "Back" button string
How to use it(Examples):
Code:
#include <a_samp>
#include <zcmd>
#define MAX_DIALOG_ITEMS 		500
#include <ndialog-pages>

new string[256];
CMD:dialogtest(playerid, params[])
{
	for(new i; i < MAX_DIALOG_ITEMS; i++)
	{
		format(string, sizeof string, "{FFFFFF}List Item {FF00FF}%i", i);
		AddDialogListitem(playerid, string);
	}
	ShowPlayerDialog(playerid, 586, DIALOG_STYLE_LIST, "{FFFFFF}Test Dialog ID {FF00FF}586", #, "Button 1", "Button 2", 25);
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 586 && response)
	{
		if(listitem != INVALID_LISTITEM)
		{
			format(string, sizeof string, "{FFFFFF}[NDialog-Pages] {FFFF00}You have selected listitem ID: %i", listitem);
			SendClientMessage(playerid, -1, string);
		}
	}
	return 0;
}
Defines:
Code:
#define INVALID_LISTITEM -1
Download:
V2.0: https://github.com/Nickk888SAMP/Dialog-Pages

Credits:
a_samp: SAMP Team
Y_Hooks: Y-Less
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)