DialogResponse listitem = SPECIFIC?
#1

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;
                }
Reply
#2

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

No one knows?
Reply
#4

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)
Reply
#5

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..
Reply
#6

if(dialogid == DIALOG_P)

this thing is above the listitem line
Reply
#7

Something like this should work:

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

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?
Reply
#9

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;
}
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)