dialog help
#1

What is the problem Only the frist one "Buy 1 C4 works.

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 29)
    {
        if(!
response)return 1;
        if(
response)   
        {
            if(
listitem == 0)
            {
                if(
c4[playerid] == 5)
                {
                      
SendClientMessage(playerid,COLOR_SILVER,"[C4]:{FFFFFF}You can only buy 5 C4.");
                    }
                    else if(
c4[playerid] == 4)
                    {
                    
GivePlayerMoney(playerid,-500);
                    
SendClientMessage(playerid,COLOR_SILVER,"[C4]:{FFFFFF}You have buy a C4 with 500$");
                    
c4[playerid] = 5;
                    }
                    else
                    {
                    
GivePlayerMoney(playerid,-500);
                    
c4[playerid] += 1;
                    
SendClientMessage(playerid,COLOR_SILVER,"[C4]:{FFFFFF}You have buy a C4 with 500$");
                    }
                if(
listitem == 1)
                    {
                    if(
c4[playerid] == 0)
                    {
                    
SendClientMessage(playerid,COLOR_SILVER,"[C4]:{FFFFFF}You have buy 5 C4 with 2500$");
                    
GivePlayerMoney(playerid,-2500);
                    
c4[playerid] = 5;
                    }
                    else
                    {
                    
SendClientMessage(playerid,COLOR_SILVER,"[C4]:{FFFFFF}You can only buy 5 C4.");
                    }
                  if(
listitem == 2)
                    {
                    if(
c4[playerid] == 0)
                    {
                    
SendClientMessage(playerid,COLOR_SILVER,"[C4]:{FFFFFF}You Don't have any C4.");
                    }
                    else
                    {
                    
GivePlayerMoney(playerid,250);
                    
SendClientMessage(playerid,COLOR_SILVER,"[C4]:{FFFFFF}You have sell a C4 for 250$");
                    
c4[playerid] -= 1;
                }
            }
            }
            }
        }
        }
    return 
0;

Reply
#2

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 29)
    {
        if(!response)return 1;
        if(response)return ShowPlayerDialog(playerid, 29, DIALOG_STYLE_LIST, "C4 shop", "Buy 1 C4     500$\nBuy 5 C4     2500$\nSell 1 C4     250$", "Buy", "Close");
        {
            switch(listitem)
            {
                case 0:
                {
                    if(c4[playerid] == 5)
                    {
                          SendClientMessage(playerid,COLOR_SILVER,"[C4]:{FFFFFF}You can only buy 5 C4.");
                    }
                    else if(c4[playerid] == 4)
                    {
                        GivePlayerMoney(playerid,-500);
                        SendClientMessage(playerid,COLOR_SILVER,"[C4]:{FFFFFF}You have buy a C4 with 500$");
                        c4[playerid] = 5;
                    }
                    else
                    {
                        GivePlayerMoney(playerid,-500);
                        c4[playerid] += 1;
                        SendClientMessage(playerid,COLOR_SILVER,"[C4]:{FFFFFF}You have buy a C4 with 500$");
                    }
                }
                case 1:
                {
                    if(c4[playerid] == 0)
                    {
                        SendClientMessage(playerid,COLOR_SILVER,"[C4]:{FFFFFF}You have buy 5 C4 with 2500$");
                        GivePlayerMoney(playerid,-2500);
                        c4[playerid] = 5;
                    }
                    else
                    {
                       SendClientMessage(playerid,COLOR_SILVER,"[C4]:{FFFFFF}You can only buy 5 C4.");
                    }
                }
                case 2:
                {
                    if(c4[playerid] == 0)
                    {
                        SendClientMessage(playerid,COLOR_SILVER,"[C4]:{FFFFFF}You Don't have any C4.");
                    }
                    else
                    {
                        GivePlayerMoney(playerid,250);
                        SendClientMessage(playerid,COLOR_SILVER,"[C4]:{FFFFFF}You have sell a C4 for 250$");
                        c4[playerid] -= 1;
                    }
                }
            }
        }
    }
    return 0;
}
Reply
#3

It works Thank you

Fixed
__________________________________________________ _____________________________________
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)