Making a dialog return to a different part of code.
#1

say i hade this dialog

ShowPlayerDialog(playerid, DIALOG_DMV, DIALOG_STYLE_MSGBOX, "DMV Car Licensing", "Would you like to take your car license now? It will cost you $600.", "Yes","No");

if i press yes how can i make it take me to the DMV code?

Regards Matt
Reply
#2

in the dialog response callback, the
Код:
if(response)
{
gets triggered when you select the button 1,orselect a menu entry. also the listitem is important then...
Reply
#3

ye but how would that take me back to where the dialog was actually created. because it will look like this:
Код:
///DMV TEST
if(pickupid == dmvcartest)
{
ShowPlayerDialog(playerid, DIALOG_DMV, DIALOG_STYLE_MSGBOX, "DMV Car Licensing", "Would you like to take your car license now? It will cost you $600.", "Yes","No");

///THE DMV CODING

}
because when it reads the dialog box it takes you to
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
So how would i get it back from public on dialog to the pickup code and how would i skip showing the dialog box again =S if you get what i mean.
Reply
#4

What are you trying to get executed when the player clicks the dialog? Not that right after you show the dialog, the code below it will be called, OnDialogResponse isn't called until the player actually clicks a button on the dialog. So, the "THE DMV CODING" is actually being called, just right after you show the dialog.
Reply
#5

so how would i go about making my dmv script? would i make a new forward? and if so how do you do it?
Reply
#6

You would need to use the OnDialogResponse callback. You want to check if the player wants to take the test now. If he clicks "Yes" from the dialog (which would be the response of 1), it'll start the test.
pawn Код:
public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
{
   switch( dialogid )
   {
      case DIALOG_DMV:
      {
         if( response ) // They've chosen "Yes" from the dialog
         {
            // Rest of your DMV code here
         }
         else // They've chosen "No" form the dialog
         {
            // Rest of "cancel" code here
         }
      }
   }
   return 1;
}
Reply
#7

Thanks alot that works =P
Reply
#8

I was wrong it doesnt seem to work when i enter the dialog it pops up and then if i press yes nothing happens if i press no nothing happens this is what ive got:
Код:
switch(dialogid)
	{
 		case DIALOG_DMVCARTEST:
 		{
 		if(response)
 		{
 		SendClientMessage(playerid, COLOUR_YELLOW, "Welcome to you the DMV Licensing Center");
 		SendClientMessage(playerid, COLOUR_YELLOW, "We will now start your test please head outside");
 		SendClientMessage(playerid, COLOUR_YELLOW, "to the test car outside.");
 		CreateVehicle(404, 1424.6630, -1700.2382, 13.0871, 358.1393, 0, 0, 0);
 		
 		}
   		else
   		{
        SendClientMessage(playerid, COLOUR_YELLOW, "Come back soon, You'll be getting find if you drive without a license.");
		}
 		
 		}

        }
Reply
#9

pawn Код:
ShowPlayerDialog(playerid, DIALOG_DMVCARTEST, DIALOG_STYLE_MSGBOX, "DMV Car Licensing", "Would you like to take your car license now? It will cost you $600.", "Yes","No");
Use this to show the dialog
Reply
#10

The dialog shows but it wont show the SendClientMessage bit and wont spawn the car
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)