SA-MP Forums Archive
DialogResponse listitem = SPECIFIC? - 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: DialogResponse listitem = SPECIFIC? (/showthread.php?tid=437666)



DialogResponse [HELP] - JohnTravis - 16.05.2013

Hi this line shows the inventory. Some people might have a laptop, some wallet, some nothing. How can I do the listitem == LAPTOP rather than 0 and WALLET rather than 1. Since if you dont have a wallet listitem == 0 will be laptop so its different for everyone. I did this about 2 years ago and I think i used strava(inputtext) or something but cant remember, any ideas?

pawn Код:
format(format1,256,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",Wallet,LapTop);
        ShowPlayerDialog(playerid, DIALOG_P, DIALOG_STYLE_LIST,"Inventory:",format1,"Use","Close");
pawn Код:
if(listitem == 0)
                {
                    return 1;
                }
                if(listitem == 1)
                {
                    if(LGWork[playerid] == 0)
                    {
                    ShowORHideMonitor(playerid,1);
                    SelectTextDraw(playerid, 0x9999BBBB);
                    LGWork[playerid] = 1;
                    }
                    else
                    {
                    ShowORHideMonitor(playerid,2);
                    CancelSelectTextDraw(playerid);
                    StopAudioStreamForPlayer(playerid);
                    LGWork[playerid] = 0;
                    }
                    return 1;
                }



Re: DialogResponse listitem = SPECIFIC? - JohnTravis - 16.05.2013

Something like if(listitem == strava("Laptop") or something, cant remember, any ideas?


Re: DialogResponse listitem = SPECIFIC? - JohnTravis - 17.05.2013

No one knows?


Re: DialogResponse listitem = SPECIFIC? - Avi Raj - 17.05.2013

Quote:

if(listitem == 0)

0 here is the dialogid or dialog define you are using.
You are using : DIALOG_P
So it should be :-
pawn Код:
if(dialogid == DIALOG_P)



Re: DialogResponse listitem = SPECIFIC? - Scrillex - 17.05.2013

Quote:
Originally Posted by Avi Raj
Посмотреть сообщение
0 here is the dialogid or dialog define you are using.
You are using : DIALOG_P
So it should be :-
pawn Код:
if(dialogid == DIALOG_P)
uhh my bad didnt read right..


Re: DialogResponse listitem = SPECIFIC? - JohnTravis - 17.05.2013

if(dialogid == DIALOG_P)

this thing is above the listitem line


Re: DialogResponse listitem = SPECIFIC? - Emmet_ - 17.05.2013

Something like this should work:

pawn Код:
if (!strcmp(inputtext, "laptop", true))
{
    // Code
}
else if (!strcmp(inputtext, "wallet", true))
{
    // Code
}



Re: DialogResponse listitem = SPECIFIC? - JohnTravis - 17.05.2013

pawn Код:
format(LapTop,24,"Laptop (x%i)",PlayerInfo[playerid][pLaptop]);
Since Im formatting a string, should I use:

pawn Код:
if (!strcmp(inputtext, "Laptop (x%i)", true))
or Laptop
pawn Код:
if (!strcmp(inputtext, LapTop, true))
and do the string Global?


Re: DialogResponse listitem = SPECIFIC? - JohnTravis - 17.05.2013

I tried this, doesnt work.
pawn Код:
new Wallet[MAX_PLAYERS][24];
pawn Код:
new format1[256];

format(Wallet[playerid],24,"Wallet ($%i)",PlayerInfo[playerid][pCash]);
format(format1,256,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",Wallet[playerid],UbranieG[playerid]);
ShowPlayerDialog(playerid, DIALOG_P, DIALOG_STYLE_LIST,"Inventory:",format1,"Use","Close");
pawn Код:
case DIALOG_P:
{
if(response)
{
if(!strcmp(inputtext, Wallet[playerid], true) )
{
//my func here
return 1;
}



Re: DialogResponse listitem = SPECIFIC? - JohnTravis - 17.05.2013

I tried this:

pawn Код:
if(!strcmp(inputtext, Wallet[playerid], true))
                {
                    SendClientMessage(playerid,COLOR_WHITE,"1");
                }
                if(!strcmp(inputtext, Wallet2[playerid], true))
                {
                    SendClientMessage(playerid,COLOR_WHITE,"2");
                }
                if(!strcmp(inputtext, Wallet3[playerid], true))
                {
                    SendClientMessage(playerid,COLOR_WHITE,"3");
                }
But whichever Waller you click on the DIALOG list you get all 3 messages shown.