SA-MP Forums Archive
How to do it - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to do it (/showthread.php?tid=561257)



How to do it - Karolukas123 - 02.02.2015

Hello, how to make it through DIALOG_STYLE_LIST clicking on the same each time you start the selection function and clicking on the next generation of the same off


Re: How to do it - supernerd2000 - 02.02.2015

You need to explain in more detail what you are looking for.

From what I can understand:
You want it so that whenever someone selects something in a dialog, it opens a different dialog?


Re: How to do it - Karolukas123 - 02.02.2015

No No, I need that selected the same line, it would act as switching on and off


Re: How to do it - Abagail - 02.02.2015

You mean like this?

pawn Код:
new string[32], switchstr[5];
switch(g_Variable)
{
    case 0: format(switchstr, sizeof(switchstr), "Off");
    default: format(switchstr, sizeof(switchstr), "On");
}
format(string, sizeof(string), "Toggle %s", switchstr);
ShowPlayerDialog(playerid, DIALOG_ONOFF, DIALOG_STYLE_MSGBOX, "Toggle", string, "Yes", "Cancel");
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
     if(!response) return 1;
     if(dialogid == DIALOG_ONOFF)
     {
          if(g_Variable)
          {
               g_Variable = 0;
               SendClientMessage(playerid, -1, "variable set to 0");
          }
          else
          {
               g_Variable = 1;
               SendClientMessage(playerid, -1, "variable set to 1");
          }
     }
return 1;
}



Re: How to do it - Karolukas123 - 02.02.2015

Yes, thanks