Saving a dialog for later
#1

How do i save a dialog into for e.g a variable? And then use it later?
Reply
#2

pawn Код:
//On Top
new DialogStr[256];
//Saving the string
format(DialogStr,sizeof(DialogStr),".....................................");
//Using it
ShowPlayerDialog(playerid,ID,DIALOG_STYLE_MSGBOX,"Dialog",DialogStr,"1","2");
Reply
#3

You should put it in a constant, would be much better.
pawn Код:
#define DIALOG "Hello, my nickname is %s!"

new string[128];
format(string,128,""DIALOG" and this is another text included!","irinel1996");
ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"My name",string,"OK","");
Reply
#4

I need to save the dialogID aswell as there are several to choose from
Reply
#5

The best way would be like this:

pawn Код:
new dialogID[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
      dialogID[playerid] = -1;
      return 1;
}


stock ShowDialogCase(playerid, caseid)
{
     switch (caseid)
     {
         case 0:
         {
              ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"My name dialog 1",string,"OK","");
              if(dialogID[playerid] != 0) dialogid[playerid] = 0;
         }
         case 1:
         {
              ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"My name dialog 2",string,"OK","");
              if(dialogID[playerid] != 1) dialogID[playerid] = 1;
         }
    }
    return caseid;
}

ShowDialogCase(playerid, dialogID[playerid]);

dialogID[playerid] = -1; // to reset

dialogID[playerid] = 1; // save the dialogid and then show by using ShowDialogCase
This is just a basic idea of how I'm doing that on my server. I'm sure you can manage it as you want.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)