SA-MP Forums Archive
AddMenu Convert to ShowPlayerDialog - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: AddMenu Convert to ShowPlayerDialog (/showthread.php?tid=267060)



AddMenu Convert to ShowPlayerDialog - pista - 07.07.2011

Hi!


How to convert Addmenu to dialog?


Old(addmenu)
pawn Код:
createVote()
{
    for (new i;i<4;i++) gVoteItems[i] = "RESET";
    DestroyMenu(voteMenu);
    voteMenu = CreateMenu("Vote",1, 50.0, 200.0, 120.0, 250.0);
    print("Creating Votemenu");
    for (new i=0;i<4;i++)
    {
        randomRaceName(i,gRaces);
        AddMenuItem(voteMenu,0,gVoteItems[i]);   // HOW TO USE THIS IS DIALOG ??
        printf("VoteOption%d: %s",i,gVoteItems[i]);
    }
    for (new i=0;i<4;i++)gVotes[i]=0;

}



Re: AddMenu Convert to ShowPlayerDialog - =WoR=Varth - 07.07.2011

https://sampwiki.blast.hk/wiki/How_to_Create_a_Dialog


Re: AddMenu Convert to ShowPlayerDialog - pista - 07.07.2011

I converted dialog just bugs

Please help

pawn Код:
new pmsg[128];
        format(pmsg,256,"%s %s");
        ShowPlayerDialog(i, tdialog, DIALOG_STYLE_LIST, "Racing vote",gVoteItems[i],gVoteItems[i], "Vote", "");



Re: AddMenu Convert to ShowPlayerDialog - =WoR=Varth - 07.07.2011

pawn Код:
ShowPlayerDialog(playerid,1,2,"Racing vote",gVoteItems[i],gVoteItems[i],"Vote","");



Re: AddMenu Convert to ShowPlayerDialog - pista - 07.07.2011

Not good.

1 race show out of 4


AddMenu:

This is a good, just i need a dialog




Re: AddMenu Convert to ShowPlayerDialog - pista - 07.07.2011

Quote:
Originally Posted by pista
Посмотреть сообщение
Not good.

1 race show out of 4


AddMenu:

This is a good, just i need a dialog

PLEASE HELP!!!!!!!!!!


Re: AddMenu Convert to ShowPlayerDialog - BigETI - 07.07.2011

pawn Код:
#define MAX_RACING_MAPS 4 //You can define here yourself the amount of racing maps you own.
#define VOTEMAP_DIALOGID    1 //You should change it if you are using another dialogs with the same ID.

stock createVote()
{
    new dstr[512], bool:check = false;
    for (new i = 0; i < MAX_RACING_MAPS; i++)
    {
        if(!check)
        {
            format(dstr, sizeof(dstr), "%s", gVoteItems[i]);
            check = true;
        }
        else format(dstr, sizeof(dstr), "%s\r\n%s", dstr, gVoteItems[i]);
    }
    ShowPlayerDialog(playerid, VOTEMAP_DIALOGID, DIALOG_STYLE_LIST, "Racing Vote", dstr, "Vote", "Cancel");
}



Re: AddMenu Convert to ShowPlayerDialog - pista - 07.07.2011

If not added
pawn Код:
for (new i;i<4;i++) gVoteItems[i] = "RESET";
server crashes..

else




Re: AddMenu Convert to ShowPlayerDialog - pista - 07.07.2011

pawn Код:
stock createVote()
{

    for (new i;i<4;i++) gVoteItems[i] = "RESET";
    new dstr[256], bool:check = false;
   // for (new i;i<4;i++) gVoteItems[i] = "RESET";
    for (new i = 0; i < MAX_RACING_MAPS; i++)
    {
        if(!check)
        {
            randomRaceName(i,gRaces);
            format(dstr, sizeof(dstr), "%s", gVoteItems[i]);
           
            check = true;
        }
        else format(dstr, sizeof(dstr), "%s\r\n%s", dstr, gVoteItems[i]);
    }
    for (new i=0;i<4;i++)gVotes[i]=0;
    for(new i=0;i<MAX_PLAYERS;i++)
    {

    ShowPlayerDialog(i, VOTEMAP_DIALOGID, DIALOG_STYLE_LIST, "Racing Vote", dstr, "Vote", "Cancel");
 }
}



Re: AddMenu Convert to ShowPlayerDialog - Kyosaur - 07.07.2011

Quote:
Originally Posted by pista
Посмотреть сообщение
If not added
pawn Код:
for (new i;i<4;i++) gVoteItems[i] = "RESET";
server crashes..

else

That might be because the strings were null before. You need to make sure they're parsing correctly (make sure you actually assign some data to them), as thats a big deal lol.


For dialogs lists you want to use strcat which will concatenate two strings together. The goal is to loop through your array of races (race name strings rather) and concatenate them all together (making sure a "\n" is added to the end, so it doesnt for a sentence like "Race1Race2Race3", but makes a list).

The wiki artcile i linked you to shows a static implementation of it, but the dynamic implementation is pretty much the same (expect its inside a loop, and uses arrays).