public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch (dialogid) { if(dialogid == 24) { if(!response) { SendClientMessage(playerid, -1, "You have closed this dialog."); return 1; // We processed it } switch(listitem) { case 0: { new jm[170]; format(jm, sizeof jm, "Type your Message Here:"); ShowPlayerDialog(playerid, 97, DIALOG_STYLE_INPUT, "Change Message", jm, "Save", "Cancel"); } case 1: { SendClientMessage(playerid, -1, "Test 2nd dialog"); } } } return 1; }
(1002) : error 002: only a single statement (or expression) can follow each "case" (1002 -- 1003) : error 029: invalid expression, assumed zero (1025) : warning 217: loose indentation Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 2 Errors.
CMD:test(playerid, params[]) { ShowPlayerDialog(playerid,24,DIALOG _STYLE_LIST,"DIALOG","First line\nSecondLine","Ok", ""); return 1; }
Originally Posted by `Compiler`
(1002) : error 002: only a single statement (or expression) can follow each "case"
|
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 24:
{
// Dialog stuff here
}
}
return 1;
}
Read this, and you have your error.
You need to follow switch statements up with case so like this; ![]() Each case represents your dialogid so you can replace case 0: with the dialog name case DIALOG_WHATEVER: pawn Код:
|
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch (dialogid) { if(dialogid == 24) { if(!response) { SendClientMessage(playerid, -1, "You have closed this dialog."); } else { switch(listitem) { case 0: { new jm[170]; format(jm, sizeof jm, "Type your Message Here:"); ShowPlayerDialog(playerid, 97, DIALOG_STYLE_INPUT, "Change Message", jm, "Save", "Cancel"); } case 1: { SendClientMessage(playerid, -1, "Test 2nd dialog"); } } } } } return 1; }
Try this code instead, not tested.
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch (dialogid) { if(dialogid == 24) { if(!response) { SendClientMessage(playerid, -1, "You have closed this dialog."); } else { switch(listitem) { case 0: { new jm[170]; format(jm, sizeof jm, "Type your Message Here:"); ShowPlayerDialog(playerid, 97, DIALOG_STYLE_INPUT, "Change Message", jm, "Save", "Cancel"); } case 1: { SendClientMessage(playerid, -1, "Test 2nd dialog"); } } } } } return 1; } |
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 0:
{
// Dialog ID 0
}
case 1:
{
// Dialog ID 1 here
}
case 2: // Dialog ID 2 here
{
}
}
return 1;
}
Then use the method I showed and then do this;
pawn Код:
|
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch (dialogid) { if(dialogid == 24) { if(response) { switch(listitem) { case 0: { new jm[170]; format(jm, sizeof jm, "Type your Message Here:"); ShowPlayerDialog(playerid, 97, DIALOG_STYLE_INPUT, "Change Message", jm, "Save", "Cancel"); } case 1: { SendClientMessage(playerid, -1, "Test 2nd dialog"); } } } else { SendClientMessage(playerid, -1, "You have closed this dialog."); } } } return 1; }
This format then. Sorry not on my PC to test.
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch (dialogid) { if(dialogid == 24) { if(response) { switch(listitem) { case 0: { new jm[170]; format(jm, sizeof jm, "Type your Message Here:"); ShowPlayerDialog(playerid, 97, DIALOG_STYLE_INPUT, "Change Message", jm, "Save", "Cancel"); } case 1: { SendClientMessage(playerid, -1, "Test 2nd dialog"); } } } else { SendClientMessage(playerid, -1, "You have closed this dialog."); } } } return 1; } |
(1002) : error 002: only a single statement (or expression) can follow each "case" (1002 -- 1003) : error 029: invalid expression, assumed zero (1025) : warning 209: function "OnDialogResponse" should return a value (1026) : error 010: invalid function or declaration Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 3 Errors.
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 24:
{
if(!response)
{
SendClientMessage(playerid, -1, "You have closed this dialog.");
}
ShowPlayerDialog(playerid, 97, DIALOG_STYLE_INPUT, "Change Message", "Type your message here:", "Save", "Cancel");
}
case 1:
{
SendClientMessage(playerid, -1, "This is the second dialog");
}
case 2:
{
}
}
return 1;
}
CMD:showdialog(playerid, params[])
{
ShowPlayerDialog(playerid, 24, DIALOG_STYLE_INPUT, "Dialog", "First Line\nSecond Line", "Ok", "");
return 1;
}