SA-MP Forums Archive
Display dialog problem. - 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: Display dialog problem. (/showthread.php?tid=283286)



Display dialog problem. - Jack_Leslie - 14.09.2011

Hey guys.
So I have a problem, my dialog isn't showing. it's a list styled dialog, and listitem 1 and above shows, but listitem 0 doesn't. Here's my code:

pawn Код:
if(dialogid == 27) //buy clothes
    {
        if(response)
        {
            if(listitem == 0) DisplayDialogForPlayer(playerid, 77);
            if(listitem == 1) DisplayDialogForPlayer(playerid, 29);
            if(listitem == 2)
            {
                new biz = GetPlayerVirtualWorld(playerid);
                PlayerInfo[playerid][pHelmet] = 18645;
                GameTextForPlayer(playerid, "~r~-$200", 5000, 1);
                GiveMoney(playerid,-200);
                BizInfo[biz][bTill] += 200;
                BizInfo[biz][bProducts] -= 1;
                PlayerPlaySound(playerid, 1052,0.0, 0.0, 0.0);
                SendClientMessage(playerid, COLOR_GRAD2, "* Helmet purchased, use /helmet to put it on.");
            }
        }
    }
And the reason it's "DisplayDialogForPlayer" is because there's a public function, and so it's actually:
pawn Код:
case 27:
        {
            ShowPlayerDialog(playerid,27,DIALOG_STYLE_LIST,"Clothes","Skin\nBandanas\nHelmet","Done","Cancel");
        }
Like I said, listitem 1 and above works, but 0 doesn't :S


Re: Display dialog problem. - Michael@Belgium - 14.09.2011

Hmm: try this:
pawn Код:
if(dialogid == 27) //buy clothes
    {
        if(response)
        {
            if(listitem == 1) DisplayDialogForPlayer(playerid, 77);
            if(listitem == 2) DisplayDialogForPlayer(playerid, 29);
            if(listitem == 3)
            {
                new biz = GetPlayerVirtualWorld(playerid);
                PlayerInfo[playerid][pHelmet] = 18645;
                GameTextForPlayer(playerid, "~r~-$200", 5000, 1);
                GiveMoney(playerid,-200);
                BizInfo[biz][bTill] += 200;
                BizInfo[biz][bProducts] -= 1;
                PlayerPlaySound(playerid, 1052,0.0, 0.0, 0.0);
                SendClientMessage(playerid, COLOR_GRAD2, "* Helmet purchased, use /helmet to put it on.");
            }
        }
    }



Re: Display dialog problem. - [MWR]Blood - 14.09.2011

Make sure you aren't using the 77 for anything else.


Re: Display dialog problem. - Jack_Leslie - 14.09.2011

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
Hmm: try this:
pawn Код:
if(dialogid == 27) //buy clothes
    {
        if(response)
        {
            if(listitem == 1) DisplayDialogForPlayer(playerid, 77);
            if(listitem == 2) DisplayDialogForPlayer(playerid, 29);
            if(listitem == 3)
            {
                new biz = GetPlayerVirtualWorld(playerid);
                PlayerInfo[playerid][pHelmet] = 18645;
                GameTextForPlayer(playerid, "~r~-$200", 5000, 1);
                GiveMoney(playerid,-200);
                BizInfo[biz][bTill] += 200;
                BizInfo[biz][bProducts] -= 1;
                PlayerPlaySound(playerid, 1052,0.0, 0.0, 0.0);
                SendClientMessage(playerid, COLOR_GRAD2, "* Helmet purchased, use /helmet to put it on.");
            }
        }
    }
Nah, that won't work.. it'll display the next one from what I selected.

@Blood:
Yeah I'm pretty sure I'm not


Re: Display dialog problem. - [MWR]Blood - 14.09.2011

Try this one.
pawn Код:
if(dialogid == 27) //buy clothes
{
    if(!response) return 0;
    if(listitem == 0)
    {
        DisplayDialogForPlayer(playerid, 77);
    }
    if(listitem == 1)
    {
        DisplayDialogForPlayer(playerid, 29);
    }
    if(listitem == 2)
    {
        new biz = GetPlayerVirtualWorld(playerid);
        PlayerInfo[playerid][pHelmet] = 18645;
        GameTextForPlayer(playerid, "~r~-$200", 5000, 1);
        GiveMoney(playerid,-200);
        BizInfo[biz][bTill] += 200;
        BizInfo[biz][bProducts] -= 1;
        PlayerPlaySound(playerid, 1052,0.0, 0.0, 0.0);
        SendClientMessage(playerid, COLOR_GRAD2, "* Helmet purchased, use /helmet to put it on.");
    }
}



Re: Display dialog problem. - Jack_Leslie - 14.09.2011

Quote:
Originally Posted by [MWR]Blood
Посмотреть сообщение
Try this one.
pawn Код:
if(dialogid == 27) //buy clothes
{
    if(!response) return 0;
    if(listitem == 0)
    {
        DisplayDialogForPlayer(playerid, 77);
    }
    if(listitem == 1)
    {
        DisplayDialogForPlayer(playerid, 29);
    }
    if(listitem == 2)
    {
        new biz = GetPlayerVirtualWorld(playerid);
        PlayerInfo[playerid][pHelmet] = 18645;
        GameTextForPlayer(playerid, "~r~-$200", 5000, 1);
        GiveMoney(playerid,-200);
        BizInfo[biz][bTill] += 200;
        BizInfo[biz][bProducts] -= 1;
        PlayerPlaySound(playerid, 1052,0.0, 0.0, 0.0);
        SendClientMessage(playerid, COLOR_GRAD2, "* Helmet purchased, use /helmet to put it on.");
    }
}
Didn't make a difference, hmm... here's the code for showing the dialog when the users chooses listitem 0:
pawn Код:
case 77:
        {
            new biz = GetPlayerVirtualWorld(playerid);
            format(string, sizeof(string), "%s",BizInfo[biz][bName]);
            ShowPlayerDialog(playerid,77,DIALOG_STYLE_INPUT,string,"Type the skin ID you want below (costs $500):","Buy","Cancel");
        }