How to use the WHERE clause similar with pawn?
#1

Hello, I'm making dynamic dealerships, but I need to get the price WHERE the model is lets say 473,

I have the following:
Check the format string for more information.
pawn Код:
if(response)
        {
            new VehName[50], priceshit[20], string[150];
            sscanf(inputtext, "s[50]s[20]", VehName,priceshit);
            DealerShipModel[playerid] = ReturnVehicleID(VehName);
            format(string,sizeof(string),"Are you sure you want to buy the following?\n\nVehicle: \t\t%s\nPrice: \t\t%s",VehicleFriendlyNames[DealerShipModel[playerid]-400], WHAT TO PUT HERE FROM MY ENUM?);
            ShowPlayerDialog(playerid, dealership2, DIALOG_STYLE_MSGBOX, "Are you sure?", string, "Buy","Cancel");
        }
Enum:
pawn Код:
enum DealerShipVehiclesCONST
{
    VModel,
    DealershipNumber,
    VPrice
}
new DealerShipVehicles[][DealerShipVehiclesCONST] =
{
    {476,2,750000},
    {511,2,720000},
    {512,2,425000},
    {513,2,400000},
    {519,2,960000},
    {520,2,1200000},
    {553,2,800000},
    {577,2,2300000},
    {592,2,2000000},
    {593,2,400000},
    {548,2,600000},
    {425,2,800000},
    {417,2,650000},
    {487,2,450000},
    {488,2,400000},
    {497,2,570000},
    {563,2,550000},
    {447,2,550000},
    {469,2,500000},
    {509,0,90000},
    {481,0,110000},
    {510,0,105000},
    {462,0,100000},
    {448,0,115000},
    {581,0,140000},
    {522,0,180000},
    {461,0,150000},
    {521,0,160000},
    {523,0,170000},
    {463,0,155000},
    {586,0,145000},
    {471,0,150000},
    {468,0,175000},
    {536,7,240000},
    {575,7,260000},
    {534,7,270000},
    {567,7,250000},
    {535,7,260000},
    {566,7,220000},
    {412,7,230000},
    {555,7,200000},
    {539,7,220000},
    {533,7,230000},
    {568,3,340000},
    {424,3,250000},
    {573,3,400000},
    {579,3,450000},
    {400,3,440000},
    {500,3,390000},
    {470,3,300000},
    {489,3,350000},
    {505,3,400000},
    {595,3,520000},
    {602,1,400000},
    {429,1,550000},
    {402,1,430000},
    {415,1,650000},
    {589,1,390000},
    {587,1,400000},
    {495,1,580000},
    {503,1,580000},
    {502,1,580000},
    {411,1,1110000},
    {603,1,590000},
    {475,1,500000},
    {506,1,650000},
    {451,1,750000},
    {558,1,440000},
    {477,1,600000},
    {541,1,640000},
    {562,1,350000},
    {504,1,450000},
    {480,1,600000},
    {419,6,200000},
    {474,6,250000},
    {467,6,230000},
    {404,6,200000},
    {418,6,220000},
    {458,6,180000},
    {561,6,300000},
    {479,6,190000},
    {496,6,220000},
    {442,6,240000},
    {483,6,200000},
    {507,6,220000},
    {508,6,240000},
    {517,6,200000},
    {518,6,190000},
    {526,6,200000},
    {529,6,240000},
    {540,6,230000},
    {545,6,290000},
    {546,6,250000},
    {547,6,230000},
    {551,6,210000},
    {580,6,230000},
    {585,6,225000},
    {527,6,190000},
    {401,4,230000},
    {516,4,220000},
    {445,4,200000},
    {419,4,230000},
    {604,4,400000},
    {474,4,250000},
    {467,4,230000},
    {410,4,180000},
    {421,4,220000},
    {426,4,190000},
    {491,4,200000},
    {549,4,240000},
    {550,4,310000},
    {492,4,240000},
    {436,4,230000},
    {466,4,250000},
    {403,9,400000},
    {413,9,230000},
    {414,9,220000},
    {422,9,230000},
    {431,9,650000},
    {440,9,260000},
    {443,9,400000},
    {445,9,350000},
    {456,9,320000},
    {459,9,160000},
    {478,9,170000},
    {482,9,160000},
    {609,9,240000},
    {498,9,250000},
    {499,9,230000},
    {514,9,370000},
    {515,9,420000},
    {524,9,320000},
    {525,9,240000},
    {543,9,200000},
    {552,9,240000},
    {554,9,220000},
    {578,9,330000},
    {582,9,180000},
    {600,9,160000},
    {406,8,4800000},
    {423,8,1200000},
    {428,8,800000},
    {444,8,2300000},
    {556,8,2400000},
    {557,8,2500000},
    {457,8,350000},
    {485,8,370000},
    {486,8,2300000},
    {530,8,280000},
    {532,8,400000},
    {531,8,340000},
    {571,8,1600000},
    {572,8,370000},
    {574,8,360000},
    {588,8,1300000},
    {472,5,290000},
    {473,5,180000},
    {493,5,360000},
    {595,5,410000},
    {484,5,420000},
    {430,5,650000},
    {453,5,300000},
    {452,5,290000},
    {409,1,400000},
    {407,10,790000},
    {544,10,710000},
    {408,10,290000},
    {416,10,820000},
    {420,10,400000},
    {427,10,1200000},
    {433,10,700000},
    {437,10,350000},
    {438,10,250000},
    {490,10,680000},
    {528,10,620000},
    {596,10,310000},
    {597,10,310000},
    {598,10,310000},
    {599,10,360000},
    {601,10,820000},
    {446,5,490000}
};
So how am I going to get the price where the model is 473 (for example)
Reply
#2

Use a loop, or have an SQLite DB.
pawn Код:
for(new i; i < sizeof(DealerShipVehicles); i++)
    if(DealerShipVehicles[i][VModel] == 473) return DealerShipVehicles[i][VPrice];
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)