public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid) // Lookup the dialogid
{
case DIALOG_(DIALOG NAME):
{
if(!response)
{
SendClientMessage(playerid, LIGHTBLUE, "You cancelled.");
return 1; // We processed it
}
switch(listitem) // This is far more efficient than using an if-elseif-else structure
{
case 0: // Listitems start with 0, not 1
{
//DO SOMETHING FOR 1ST LINE
}
case 1:
{
//DO SOMETHING FOR 2ND LINE
}
// Add the rest of your listitems for dialog 1 here
}
return 0; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.).
}
|
Firstly,you need to define the dialog ids.
DIALOG_(DIALOG NAME) Then,you do ShowPlayerDialog(); (see wikia for the tags) Then, public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch(dialogid) // Lookup the dialogid { case DIALOG_(DIALOG NAME): { if(!response) { SendClientMessage(playerid, LIGHTBLUE, "You cancelled."); return 1; // We processed it } switch(listitem) // This is far more efficient than using an if-elseif-else structure { case 0: // Listitems start with 0, not 1 { //DO SOMETHING FOR 1ST LINE } case 1: { //DO SOMETHING FOR 2ND LINE } // Add the rest of your listitems for dialog 1 here } return 0; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.). } |
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == /*dialog id here*/)
{
//code
}
if(dialogid == /*other dialog id*/)
{
//more code
}
return 1;
}
|
this will give a lot of errors.
you can check out the wiki. It is like this pawn Код:
|