17.03.2013, 18:02
So I was experimenting with dialogs, to see what would be the easiest way to make them. Would this be the proper, effective way? I'm just here to clarify if it is or not.
PS: It does work in-game. No bugs.
PS: It does work in-game. No bugs.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == MAIN_DIALOG && response)
{
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid,IN_WEAPONS, DIALOG_STYLE_LIST, "Weapons","Option 1\nOption 2","Select","Return");
}
case 1:
{
ShowPlayerDialog(playerid,IN_TELEPORTS, DIALOG_STYLE_LIST, "Teleports","Option1\nOption 2","Select","Return");
}
}
}
if(dialogid == IN_WEAPONS)
{
switch(listitem)
{
case 0:
{
if(!response) return ShowPlayerDialog(playerid, MAIN_DIALOG, DIALOG_STYLE_LIST, "Main Dialog.", "Weapons\nTeleports","Select","Cancel");
SendClientMessage(playerid, -1, "You selected option 1.");
}
case 1:
{
if(!response) return ShowPlayerDialog(playerid, MAIN_DIALOG, DIALOG_STYLE_LIST, "Main Dialog.", "Weapons\nTeleports","Select","Cancel");
SendClientMessage(playerid, -1, "You selected option 2.");
}
}
}
if(dialogid == IN_TELEPORTS)
{
switch(listitem)
{
case 0:
{
if(!response) return ShowPlayerDialog(playerid, MAIN_DIALOG, DIALOG_STYLE_LIST, "Main Dialog.", "Weapons\nTeleports","Select","Cancel");
SendClientMessage(playerid, -1, "You selected option 1.");
}
case 1:
{
if(!response) return ShowPlayerDialog(playerid, MAIN_DIALOG, DIALOG_STYLE_LIST, "Main Dialog.", "Weapons\nTeleports","Select","Cancel");
SendClientMessage(playerid, -1, "You selected option 2.");
}
}
}
return 1;
}