How to create multiple dialogs
#1

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
    if(dialogid == DIALOG_CLASS) {
        if(!response) // if player presses ESC re-show the dialog
            return ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose your class", "Class 1\nClass 2\nClass 3", "Choose", "");
        switch(listitem) {
            case 0: 
			 		{
     				ShowPlayerDialog(playerid, DIALOG_ASSAULT, DIALOG_STYLE_MSGBOX, "Class information", "information of the class....", "Choose", "Back");
            		}
            case 1: {
     					//dialogg
            		}
            case 2: { // CLASS 3
                		// stuff for class 3
            		}
            			if(dialogid == DIALOG_ASSAULT) {
            			return ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Class information", "information of the class....", "Choose", "Back");
        				switch(listitem) {
            			case 0:
			 					{
     								GivePlayerWeapon(32,80)
            					}
    					case 1: {


            					}
            			case 2: { 
            			
            					}
        }
    }
    return 0;
}
Take a look at this script, but I cant get this in work.. I want if a player choose class1, the player redirected to another dialog with class info such as weapons, abilities. Any suggestions? (rep+)
Reply
#2

For example: CMD:dialog you would add the info of the "Class" In your case then from there on, you would add the Dialog Response, if thats what you mean. Do you get me or is it confusing?
Reply
#3

I think this is what your looking for;

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == DIALOG_CLASS)
	{
		if(!response) return ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose your class", "Class 1\nClass 2\nClass 3", "Choose", "");
		switch(listitem)
		{
			case 0:
			{
				ShowPlayerDialog(playerid, Class1, DIALOG_STYLE_MSGBOX, "Class 1 information", "Information...", "Choose", "Cancel");
			}
			case 1:
			{
				ShowPlayerDialog(playerid, Class2, DIALOG_STYLE_MSGBOX, "Class 2 information", "Information...", "Choose", "Cancel");
			}
			case 2:
			{
				ShowPlayerDialog(playerid, Class3, DIALOG_STYLE_MSGBOX, "Class 3 information", "Information...", "Choose", "Cancel");
			}
		}
	}
	if(dialogid == Class1)
	{
		if(response)
		{
			GivePlayerWeapon(playerid, 23, 200);
			SetPlayerHealth(playerid, 100);
			SetPlayerSkin(playerid, 8);
		}
		else return ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose your class", "Class 1\nClass 2\nClass 3", "Choose", "");
	}
	if(dialogid == Class2)
	{
		if(response)
		{
			GivePlayerWeapon(playerid, 23, 200);
			SetPlayerHealth(playerid, 100);
			SetPlayerSkin(playerid, 8);
		}
		else return ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose your class", "Class 1\nClass 2\nClass 3", "Choose", "");
	}
	if(dialogid == Class3)
	{
		if(response)
		{
			GivePlayerWeapon(playerid, 23, 200);
			SetPlayerHealth(playerid, 100);
			SetPlayerSkin(playerid, 8);
		}
		else return ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Choose your class", "Class 1\nClass 2\nClass 3", "Choose", "");
	}
		
	return 1;
}
Basically when you click a class, it brings up a new dialog showing all the information. if you click choose it sets you with that class's health/skin/weapons ect. obviously you just add your stuff in there...

don't forget to +rep
Reply
#4

Yeaahh great!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)