Today i will show you on how to make dialogs in pages using DIALOG_STYLE_MSGBOX,
and for the help comand how to switch between dialogs
first:
second: define some colors that we will use later on to our dialogs
third:
this enumerator will define our dialogs
forth: we will make some commands and explain some other functions
why we are using strcat?
we can get our messages trough our decailed variable as string
Destination is our string
const source is our message
at the end we have a callback like this
click here: >> https://pastebin.com/LeHMkJhb
zcmd by Zeex click here http://forum.sa-mp.com/showthread.php?t=91354
Attachment 11205
and for the help comand how to switch between dialogs
first:
Code:
#include <a_samp>
#include <zcmd> //if you don not have zcmd include ill give you a link on where to get it
Code:
#define WHITE "{ffffff}"
#define YELLOW "{ffff00}"
#define RED "{ff0000}"
Code:
enum
{
DIALOG_HELP,
DIALOG_CMDS
}
forth: we will make some commands and explain some other functions
Code:
CMD:help(playerid, params[])
{
new listitem[] = "Commands";
//this type of declaired variable is like a array data type
ShowPlayerDialog(playerid, DIALOG_HELP, DIALOG_STYLE_LIST, ""WHITE"Help", listitem, ""WHITE"Select", ""WHITE"Exit");
return 1;
}
CMD:cmds(playerid, params[])
{
new string[128]; //<-- declaired variable with length size 128
strcat(string, ""YELLOW"Example command #1\n"); //string is our destination
strcat(string, ""YELLOW"Example command #2\n"); //
strcat(string, ""YELLOW"Example command #3\n");
ShowPlayerDialog(playerid, DIALOG_CMDS, DIALOG_STYLE_MSGBOX, ""WHITE"Commands Page: 1/2", string, ""WHITE"Next", ""WHITE"Exit");
return 1;
}
we can get our messages trough our decailed variable as string
Destination is our string
const source is our message
at the end we have a callback like this
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid) //this method is switching between dialogs if we have more then / above 2-3 dialogs
{
case DIALOG_HELP: //in-case we are responding to the dialog help
{
if(response)
{
switch(listitem) we can switch between dialogs
{
case 0: cmd_cmds(playerid, ""); //using most cases with numbers varies how meny items we put to the list you can also do with commands to ez up the process
}
}
}
case DIALOG_CMDS: //in-case we are responding to the dialog cmds
{
if(response) // if we clicked Next or pressed Enter to proceed to the next page / page nr 2
{
new string[128];
strcat(string, ""RED"Example command #4\n");
strcat(string, ""RED"Example command #5\n");
strcat(string, ""RED"Example command #6\n");
// we added +1 at the end of DIALOG_CMDS for showing the second page
ShowPlayerDialog(playerid, DIALOG_CMDS+1, DIALOG_STYLE_MSGBOX, ""WHITE"Commands Page: 2/2", string, ""WHITE"Exit", "");
}
}
// Proccess more dialog case's
}
return 1;
}
zcmd by Zeex click here http://forum.sa-mp.com/showthread.php?t=91354
Attachment 11205