Need Help Adding Multiple Commands to Dialog
#1

I am trying to organize my commands into dialog boxes but im sure there are too many to add in one line. Im not sure how to make it work to where all the commands are in one dialog message box. Help?

Code:
Код:
	
if(dialogid==1 && response==1)
	{
		switch(listitem)
		{
			case 0:
			{
				ShowPlayerDialog(playerid, 5002, DIALOG_STYLE_MSGBOX, "General Commands", " (COMMANDS HERE) ", "Ok", "Exit");
			}
			case 1:
			{
				ShowPlayerDialog(playerid, 5003, DIALOG_STYLE_MSGBOX, "Family Commands", " (COMMANDS HERE) ", "Ok", "Exit");
			}
			case 2:
			{
				ShowPlayerDialog(playerid, 5004, DIALOG_STYLE_MSGBOX, "Faction Commands", " (COMMANDS HERE) ", "Ok", "Exit");
			}
		}
	}
	return 1;
}
Reply
#2

its to simple, use DIALIG_STYLE_LIST
example:
pawn Код:
if(!strcmp(cmdtext, "/drinks", true))
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose one", "Cmds\nG CMDS\nF CMDS", "Ok", "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
                {
                   ShowPlayerDialog(playerid, 1 , DIALOG_STYLE_MSGBOX, "Cmds here!", "Ok," , "Exit");
                }
                case 1: // The second item listed
                {
                  ShowPlayerDialog(playerid, 1 , DIALOG_STYLE_MSGBOX, "G Cmds here!", "Ok," , "Exit");
                }
                case 2: // The third item listed
                {
                   ShowPlayerDialog(playerid, 1 , DIALOG_STYLE_MSGBOX, "F Cmds here!", "Ok," , "Exit");
                }
            }
            }
    }
    }
    return 1;
} //Edited, main one by SAMP Wiki.
hope it helps..
Reply
#3

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == 2) {
			ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Commands", "General Commands\nFamily Commands\nFaction Commands", "Ok", "Back");
		}
		if(dialogid == 1) {
		    if(response) {
		        switch(listitem) {
				case 0:
				{
					ShowPlayerDialog(playerid, 5002, DIALOG_STYLE_MSGBOX, "General Commands", " (COMMANDS HERE) ", "Ok", "Exit");
				}
				case 1:
				{
					ShowPlayerDialog(playerid, 5003, DIALOG_STYLE_MSGBOX, "Family Commands", " (COMMANDS HERE) ", "Ok", "Exit");
				}
				case 2:
				{
					ShowPlayerDialog(playerid, 5004, DIALOG_STYLE_MSGBOX, "Faction Commands", " (COMMANDS HERE) ", "Ok", "Exit");
				}
			}
		}
		return 1;
	}
Reply
#4

Thanks for the reply, but I have everything set up. Its just I have a lot of commands to add, if I add too many to one "case" i will get an error...

I will try to put the commands in. And if I get an error I will post it, thanks guys.
Reply
#5

Dude, then show us the error and we will help fixing it..
Reply
#6

Ok, here is the error:

Код:
C:\Users\Family\Desktop\New Evo Roleplay2\gamemodes\Test.pwn(246) : error 075: input line too long (after substitutions)
C:\Users\Family\Desktop\New Evo Roleplay2\gamemodes\Test.pwn(247) : error 037: invalid string (possibly non-terminated string)
C:\Users\Family\Desktop\New Evo Roleplay2\gamemodes\Test.pwn(247) : error 029: invalid expression, assumed zero
C:\Users\Family\Desktop\New Evo Roleplay2\gamemodes\Test.pwn(247) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid==1 && response==1)
	{
		switch(listitem)
		{
			case 0:
			{
				ShowPlayerDialog(playerid, 5002, DIALOG_STYLE_MSGBOX, "General Commands", "/help/gatehelp /changegatepass /fishhelp /sellfish /fishes /fish /stuck /train /tow /gascan /fuel /cookieshelp /usecookies /refhelp /refer /accent /license /showlicense /getlic\n /getweaplic /joinevent /quitevent /helpers /chat /speedlimit /locatecar /buycar /sellcartomarket /slot /park /engine /points /families /updates /id /changepass\n /search /drop /pay /paycheck /wire /withdraw /deposit /serverstats /reportbug /jobhelp /bid /fight /househelp /hwithdraw /hdeposit /vehhelp /bizhelp /skill /join\n /quitjob /houseupgrade /bizupgrade /vault /buyproducts /lights /trunk /bonnet /lock /buyhouse /sellhousetomarket /buybiz /sellbiztomarket /o /n /newbie /gate /door\n /accept /cancel /admins /rolldce /list /speedo /sms /call /p /pickup /hangup /smartphone /internet /buysim /wt /wtc /blindfold /unblindfold /eject /tie /untie\n /colorcar /paintcar /buytoys /toys /buyclothes /buy /phonebook /ad /enter /exit /stats /bizstats /helpme /report /b /s /l /w /me /do /animlist /animhelp /ro /robberyhelp /setuprobbery /joinrobbery /acceptrobbery /startrobbery", "Ok", "Exit");
			}
			case 1:
			{
				ShowPlayerDialog(playerid, 5003, DIALOG_STYLE_MSGBOX, "Family Commands", " (COMMANDS HERE) ", "Ok", "Exit");
			}
			case 2:
			{
				ShowPlayerDialog(playerid, 5004, DIALOG_STYLE_MSGBOX, "Faction Commands", " (COMMANDS HERE) ", "Ok", "Exit");
			}
		}
	}
	return 1;
}
Reply
#7

Use strcat.
Reply
#8

Ok, but how will I go about it to put it in the "case 0:", "case 1:", and "case 2:"?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)