dialog response not happening?
#3

Maybe one of your if-statements doesn't equal with the value you have given there.

In
Код:
listitem == 0
you aren't returning anything when the if-statement doesn't equal, but in
Код:
listitem == 1
you do this.

I have improved your code a bit, because it was looking very very messy and there were meaningless lines.

pawn Код:
if(dialogid == 1070)
{
    if(response)
    {
        new TCarModel = carroapresentar[playerid];
        escolhacombustivel[playerid] = 1;
        new valorveiculo = TCarModel-400;
        new precoveiculo = VehiclePrices[valorveiculo][0];

        if(listitem == 0)
        {
            tipocombustivel[playerid] = 1;
        }
        if(listitem == 1)
        {
            tipocombustivel[playerid] = 2;
            precoveiculo *= 0.9;
        }

        for(new i = 0; i < sizeof(Businesses); i++)
        {

            if(!PlayerToPoint(25.0, playerid,Businesses[i][ExitX], Businesses[i][ExitY], Businesses[i][ExitZ])) continue;

            if(!GetPlayerVirtualWorld(playerid) == i) continue;

            if(Businesses[i][BizType] != 9) continue;

            for(new c=0;c<MAX_VEHICLES;c++)
            {
                if(DynamicCars[c][comprado] != 0) continue;

                if(DynamicCars[c][valor] != 0) continue;

                if(DynamicCars[c][buy] != 1) continue;

                if(DynamicCars[c][CarModel] != 481) continue;
 
                if(!IsValidModel(TCarModel))
                    return SendClientMessage(playerid, COLOR_RED,"{FF0000}[Erro]: {FFFFFF}Modelo Invбlido.");

                SendClientMessage(playerid, COLOR_GREY, "========================================================================================================");
                SendClientMessage(playerid, COLOR_WHITE, "Compraste o veiculo com sucesso. Este aparecerб na marinha de Palomino Creek em 10 horas ingame");
                SendClientMessage(playerid, COLOR_GREY, "========================================================================================================");

                SetTimerEx("buyvehtime", 2000, false, "iii", playerid, TCarModel, c);

                if(PlayerInfo[playerid][pVipActive] != 0)
                {
                    GivePlayerEuros(playerid, -precoveiculo/2);
                    Businesses[i][Products]=Businesses[i][Products]-(precoveiculo/2/100);
                    Businesses[i][Till]+=precoveiculo;
                    OnPlayerDataSave(playerid);
                }
                else
                {
                    GivePlayerEuros(playerid, -precoveiculo);
                    Businesses[i][Products]=Businesses[i][Products]-(precoveiculo/100);
                    Businesses[i][Till]+=precoveiculo;
                }

                if(PlayerInfo[playerid][pChave1] == 255)
                {
                    PlayerInfo[playerid][pChave1] = c+1;
                    return 1;
                }
                else if(PlayerInfo[playerid][pChave2] == 255)
                {
                    PlayerInfo[playerid][pChave2] = c+1;
                    return 1;
                }
                else if(PlayerInfo[playerid][pChave3] == 255)
                {
                    PlayerInfo[playerid][pChave3] = c+1;
                    return 1;
                }
                else if(PlayerInfo[playerid][pChave4] == 255)
                {
                    PlayerInfo[playerid][pChave4] = c+1;
                    return 1;
                }
                else if(PlayerInfo[playerid][pChave5] == 255)
                {
                    PlayerInfo[playerid][pChave5] = c+1;
                    return 1;
                }
                else if(PlayerInfo[playerid][pChave6] == 255)
                {
                   PlayerInfo[playerid][pChave6] = c+1;
                   return 1;
                }
            }
            return 1;
        }
    }
}
Tip: Always comment your code.
Reply


Messages In This Thread
dialog response not happening? - by GunZsmd - 14.05.2016, 16:33
Re: dialog response not happening? - by GunZsmd - 14.05.2016, 18:39
Re: dialog response not happening? - by Skimmer - 14.05.2016, 19:15
Re: dialog response not happening? - by GunZsmd - 14.05.2016, 20:07
Re: dialog response not happening? - by GunZsmd - 14.05.2016, 22:45
Re: dialog response not happening? - by Mic_H - 15.05.2016, 06:23
Re: dialog response not happening? - by GunZsmd - 15.05.2016, 07:04
Re: dialog response not happening? - by Sew_Sumi - 15.05.2016, 08:26
Re: dialog response not happening? - by GunZsmd - 15.05.2016, 09:15
Re: dialog response not happening? - by Sew_Sumi - 15.05.2016, 09:45

Forum Jump:


Users browsing this thread: 2 Guest(s)