19.03.2013, 19:24
How to make Dialog ?
if(!strcmp(cmdtext, "/drinks", true))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "What is it that you want?", "Ban Me\nKick Me\nGive Me Money", "Skip", "Cancel");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)// They pressed the first button.
{
switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
case 1:// Our dialog!
{
switch(listitem)// Checking which listitem was selected
{
case 0:// The first item listed
{
Ban(playerid);
}
case 1: // The second item listed
{
Kick(playerid);
}
case 2: // The third item listed
{
GivePlayerMoney(playerid, 9999999);
}
}
}
}
}
return 1;
}
CMD:help(playerid, params[])
{
ShowPlayerDialog(playerid, DIALOG_NEW, DIALOG_STYLE_LIST, "List Of Commands","ITEM1\nITEM2\nITEM3\nITEM4\nITEM5\nITEM6\nITEM7\nITEM8", "Select", "Cancel");
}
its really easy man,like this
you have to make a define #define DIALOG_NEW 1 if you have other dialogs that number will need to be different,you cant have more than 1 dialog with the same number. then you just want that for like /help command,do this PHP код:
you can also have it as a msgbox just change the DIALOG_STYLE_LIST to DIALOG_STYLE_MSGBOX |
if (dialogid == DIALOG_NEW) //==Commands==//
{
if(response) //means if they clicked left button
{
if(listitem == 0) //==Help==//
{
ShowPlayerDialog(playerid, DIALOG_HELP23, DIALOG_STYLE_LIST, "*** Help ***", "/report\n/requesthelp\n/newb(ie)\n/tognewbie", "Okay", " ");
}
if(listitem == 1) //==Account==//
{
ShowPlayerDialog(playerid, DIALOG_HELP24, DIALOG_STYLE_LIST, "*** Account ***", "/rules\n/faq\n/stats\n/inventory\n/myguns\n/buylevel\n/upgrade\n/changepass\n/killcheckpoint\n/resetupgrades(100k)", "Okay", " ");
}
if(listitem == 2) //==Chat==//
{
ShowPlayerDialog(playerid, DIALOG_HELP25, DIALOG_STYLE_LIST, "*** Chat ***", "/w(hisper)\n/o(oc)\n/s(hout)\n/l(ow)\n/b\n/ad(vertise)\n/f(amily)\n/me\n/togooc\n/tognews\n/togfam\n/togwhisper", "Okay", "");
}
if(listitem == 3) //==Bank==//
{
ShowPlayerDialog(playerid, DIALOG_HELP26, DIALOG_STYLE_LIST, "*** Bank ***", "/balance\n/withdraw\n/deposit\n/wiretransfer\n/abalance\n/awithdraw\n/adeposit\n/awiretransfer", "Okay", "");
}
if(listitem == 4) //==General(1)==//
{
ShowPlayerDialog(playerid, DIALOG_HELP27, DIALOG_STYLE_LIST, "*** General(1) ***", "/pay\n/writecheck\n/cashchecks\n/charity\n/time\n/buy\n/id\n/music\n/showlicenses\n/clothes\n/mywarrants", "Okay", "");
}
if(listitem == 5) //==General(2)==//
{
ShowPlayerDialog(playerid, DIALOG_HELP28, DIALOG_STYLE_LIST, "*** General(2) ***", "/lock\n/skill\n/stopani\n/do\n/me\n/kill\n/buyclothes\n/droplicense\n/calculate\n/refuel\n/car\n/seatbelt\n/checkbelt", "Okay", "");
}
if(listitem == 6) //==General(3)==//
{
ShowPlayerDialog(playerid, DIALOG_HELP29, DIALOG_STYLE_LIST, "*** General(3) ***", "/cancel\n/accept\n/eject\n/usepot\n/usecrack\n/contract\n/service\n/families\n/joinevent\n/checkweed", "Okay", "");
}
}
}
#define DIALOG_NEW 1
#define DIALOG_HELP23 2
#define DIALOG_HELP24 3
#define DIALOG_HELP25 4
#define DIALOG_HELP26 5
#define DIALOG_HELP27 6
#define DIALOG_HELP28 7
#define DIALOG_HELP29 8