---------------------------
enum vInfo
{
vID,
vStock,
vPrice,
vModel,
vName[255]
};
new Stock[102][vInfo];
------------------------------
public LoadStock()
{
stockss = cache_num_rows();
for(new i = 1; i <= stockss; i++)
{
new s = i - 1;
Stock[i][vID] = cache_get_field_content_int(s, "ID");
Stock[i][vStock] = cache_get_field_content_int(s, "Stock");
Stock[i][vPrice] = cache_get_field_content_int(s, "Price");
Stock[i][vModel] = cache_get_field_content_int(s, "vid");
cache_get_field_content(s, "Car", Stock[i][vName], SQL, 130);
}
printf("Stocks: %d", stockss);
}
public LoadCar()
{
masini = cache_num_rows();
for(new i = 1; i <= masini; i++)
{
new c = i - 1;
CarInfo[i][cID] = cache_get_field_content_int(c, "ID");
CarInfo[i][cModel] = cache_get_field_content_int(c, "Model");
CarInfo[i][cLocationx] = cache_get_field_content_float(c, "Locationx");
CarInfo[i][cLocationy] = cache_get_field_content_float(c, "Locationy");
CarInfo[i][cLocationz] = cache_get_field_content_float(c, "Locationz");
CarInfo[i][cAngle] = cache_get_field_content_float(c, "Angle");
CarInfo[i][cColorOne] = cache_get_field_content_int(c, "ColorOne");
CarInfo[i][cColorTwo] = cache_get_field_content_int(c, "ColorTwo");
cache_get_field_content(c, "Owner", CarInfo[i][cOwner], SQL, 130);
CarInfo[i][cValue] = cache_get_field_content_int(c, "Value");
cache_get_field_content(c, "License", CarInfo[i][cLicense], SQL, 130);
cache_get_field_content(c, "Description", CarInfo[i][cDescription], SQL, 130);
CarInfo[i][cLock] = cache_get_field_content_int(c, "Lockk");
CarInfo[i][cTimed] = cache_get_field_content_int(c, "Timed");
CarInfo[i][cInscarprice] = cache_get_field_content_int(c, "Inscarprice");
CarInfo[i][cInsurancecar] = cache_get_field_content_int(c, "Insurancecar");
CarInfo[i][cKM] = cache_get_field_content_float(c, "KM");
CarInfo[i][cOwned] = cache_get_field_content_int(c, "Owned");
CarInfo[i][cSell] = cache_get_field_content_int(c, "Sell");
CarInfo[i][mod1] = cache_get_field_content_int(c, "mod1");
CarInfo[i][mod2] = cache_get_field_content_int(c, "mod2");
CarInfo[i][mod3] = cache_get_field_content_int(c, "mod3");
CarInfo[i][mod4] = cache_get_field_content_int(c, "mod4");
CarInfo[i][mod5] = cache_get_field_content_int(c, "mod5");
CarInfo[i][mod6] = cache_get_field_content_int(c, "mod6");
CarInfo[i][mod7] = cache_get_field_content_int(c, "mod7");
CarInfo[i][mod8] = cache_get_field_content_int(c, "mod8");
CarInfo[i][mod9] = cache_get_field_content_int(c, "mod9");
CarInfo[i][mod10] = cache_get_field_content_int(c, "mod10");
CarInfo[i][mod11] = cache_get_field_content_int(c, "mod11");
CarInfo[i][mod12] = cache_get_field_content_int(c, "mod12");
CarInfo[i][mod13] = cache_get_field_content_int(c, "mod13");
CarInfo[i][mod14] = cache_get_field_content_int(c, "mod14");
CarInfo[i][mod15] = cache_get_field_content_int(c, "mod15");
CarInfo[i][mod16] = cache_get_field_content_int(c, "mod16");
CarInfo[i][mod17] = cache_get_field_content_int(c, "mod17");
CarInfo[i][cPaintJ] = cache_get_field_content_int(c, "PaintJ");
}
printf("Cars: %d", masini);
}
------------------------------------------------------------
if(dialogid == DIALOG_NOSTOCK)
{
if(response)
{
hidePlayerDialog(playerid);
BuyCar[playerid] = 0;
}
return 1;
}
if(dialogid == DIALOG_CARBUY5)
{
if(response)
{
new num = BuyCar[playerid];
if(GetPlayerCash(playerid) >= Stock[num][vPrice])
{
if(Stock[num][vStock] > 0)
{
InsertCar(playerid,1,num);
}
else
{
new stringg[MAX_STRING];
format(stringg,sizeof(stringg),"Aceasta masina numai este disponibila in Dealership. Stoc epuizat.\nYou can't buy this vehicle from the dealership. Out of stock.");
ShowPlayerDialog(playerid, DIALOG_NOSTOCK, DIALOG_STYLE_MSGBOX, "Out of stock", stringg, "Close","");
}
}
else return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to purchase this vehicle.");
}
return 1;
}
if(dialogid == DIALOG_CARBUY2)
{
if(response)
{
new num = listitem + 1;
BuyCar[playerid] = num;
new string33[256], stringtitle[256];
format(stringtitle, sizeof(stringtitle), "%s ($%s) - %s available", Stock[num][vName], FormatNumber(Stock[num][vPrice]), FormatNumber(Stock[num][vStock]));
format(string33, sizeof(string33), "Vehicle name: %s\nVehicle price: %s\nNumber of cars available: %s", Stock[num][vName], FormatNumber(Stock[num][vPrice]), FormatNumber(Stock[num][vStock]));
ShowPlayerDialog(playerid, DIALOG_CARBUY5, DIALOG_STYLE_MSGBOX, stringtitle, string33, "Buy car", "Back");
}
return 1;
}
if(dialogid == DIALOG_CARBUY3)
{
if(response)
{
new cheapcars;
for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
{
if(Stock[xf][vPrice] > 0 && Stock[xf][vPrice] <= 7000000)
{
cheapcars = xf;
}
}
new num = listitem + cheapcars + 1;
BuyCar[playerid] = num;
new string33[256], stringtitle[256];
format(stringtitle, sizeof(stringtitle), "%s ($%s) - %s available", Stock[num][vName], FormatNumber(Stock[num][vPrice]), FormatNumber(Stock[num][vStock]));
format(string33, sizeof(string33), "Vehicle name: %s\nVehicle price: %s\nNumber of cars available: %s", Stock[num][vName], FormatNumber(Stock[num][vPrice]), FormatNumber(Stock[num][vStock]));
ShowPlayerDialog(playerid, DIALOG_CARBUY5, DIALOG_STYLE_MSGBOX, stringtitle, string33, "Buy car", "Back");
}
return 1;
}
if(dialogid == DIALOG_CARBUY4)
{
if(response)
{
new regcheapcars;
for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
{
if(Stock[xf][vPrice] > 7000000 && Stock[xf][vPrice] <= 19999999)
{
regcheapcars = xf;
}
}
new num = listitem + regcheapcars + 1;
BuyCar[playerid] = num;
new string33[256], stringtitle[256];
format(stringtitle, sizeof(stringtitle), "%s ($%s) - %s available", Stock[num][vName], FormatNumber(Stock[num][vPrice]), FormatNumber(Stock[num][vStock]));
format(string33, sizeof(string33), "Vehicle name: %s\nVehicle price: %s\nNumber of cars available: %s", Stock[num][vName], FormatNumber(Stock[num][vPrice]), FormatNumber(Stock[num][vStock]));
ShowPlayerDialog(playerid, DIALOG_CARBUY5, DIALOG_STYLE_MSGBOX, stringtitle, string33, "Buy car", "Back");
}
return 1;
}
if(dialogid == DIALOG_CARBUY)
{
if(response)
{
if(listitem == 0)
{
new stringzz[MAX_STRING],stringy[MAX_STRING];
for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
{
if(Stock[xf][vPrice] > 0 && Stock[xf][vPrice] <= 7000000)
{
format(stringy, sizeof(stringy), "%s ($%d) - %d in stock\n", Stock[xf][vName], Stock[xf][vPrice], Stock[xf][vStock]);
strcat(stringzz,stringy);
}
}
ShowPlayerDialog(playerid, DIALOG_CARBUY2, DIALOG_STYLE_LIST, "Buy a car", stringzz, "Select", "Close");
}
if(listitem == 1)
{
new stringzz[MAX_STRING],stringy[MAX_STRING];
for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
{
if(Stock[xf][vPrice] > 7000000 && Stock[xf][vPrice] <= 19999999)
{
format(stringy, sizeof(stringy), "%s ($%d) - %d in stock\n", Stock[xf][vName], Stock[xf][vPrice], Stock[xf][vStock]);
strcat(stringzz,stringy);
}
}
ShowPlayerDialog(playerid, DIALOG_CARBUY3, DIALOG_STYLE_LIST, "Buy a car", stringzz, "Select", "Close");
}
if(listitem == 2)
{
new stringzz[MAX_STRING],stringy[MAX_STRING];
for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
{
if(Stock[xf][vPrice] >= 20000000 && Stock[xf][vPrice] < 50000000)
{
format(stringy, sizeof(stringy), "%s ($%d) - %d in stock\n", Stock[xf][vName], Stock[xf][vPrice], Stock[xf][vStock]);
strcat(stringzz,stringy);
}
}
ShowPlayerDialog(playerid, DIALOG_CARBUY4, DIALOG_STYLE_LIST, "Buy a car", stringzz, "Select", "Close");
}
if(listitem == 3)
{
new string2[MAX_STRING];
format(string2,sizeof(string2),"Sparrow - 230 premium points\nHotring Racer - 250 premium points\nVortex - 250 premium points\nHotring Racer A - 250 premium points\nHotring Racer B - 250 premium points\nMaverick - 300 premium points");
ShowPlayerDialog(playerid, DIALOG_CARBUY8, DIALOG_STYLE_LIST, "Buy a car", string2, "Select", "Close");
}
}
return 1;
}
if(dialogid == DIALOG_CARBUY
{
if(response)
{
if(listitem == 0)
{
if(PlayerInfo[playerid][pPremiumPoints] < 230) return SCM(playerid,COLOR_WHITE,"{FFB870}You don't have 230 premium points.");
PlayerInfo[playerid][pPremiumPoints] -= 230;
Update(playerid,pPremiumPointsx);
InsertPCar(playerid,469,Stock[95][vPrice],"Sparrow",1);
}
if(listitem == 1)
{
if(PlayerInfo[playerid][pPremiumPoints] < 250) return SCM(playerid,COLOR_WHITE,"{FFB870}You don't have 250 premium points.");
PlayerInfo[playerid][pPremiumPoints] -= 250;
Update(playerid,pPremiumPointsx);
InsertPCar(playerid,494,Stock[96][vPrice],"Hotring Racer",1);
}
if(listitem == 2)
{
if(PlayerInfo[playerid][pPremiumPoints] < 250) return SCM(playerid,COLOR_WHITE,"{FFB870}You don't have 250 premium points.");
PlayerInfo[playerid][pPremiumPoints] -= 250;
Update(playerid,pPremiumPointsx);
InsertPCar(playerid,539,Stock[97][vPrice],"Vortex",1);
}
if(listitem == 3)
{
if(PlayerInfo[playerid][pPremiumPoints] < 250) return SCM(playerid,COLOR_WHITE,"{FFB870}You don't have 250 premium points.");
PlayerInfo[playerid][pPremiumPoints] -= 250;
Update(playerid,pPremiumPointsx);
InsertPCar(playerid,502,Stock[98][vPrice],"Hotring Racer A",1);
}
if(listitem == 4)
{
if(PlayerInfo[playerid][pPremiumPoints] < 250) return SCM(playerid,COLOR_WHITE,"{FFB870}You don't have 250 premium points.");
PlayerInfo[playerid][pPremiumPoints] -= 250;
Update(playerid,pPremiumPointsx);
InsertPCar(playerid,503,Stock[99][vPrice],"Hotring Racer B",1);
}
if(listitem == 5)
{
if(PlayerInfo[playerid][pPremiumPoints] < 300) return SCM(playerid,COLOR_WHITE,"{FFB870}You don't have 300 premium points.");
PlayerInfo[playerid][pPremiumPoints] -= 300;
Update(playerid,pPremiumPointsx);
InsertPCar(playerid,487,Stock[100][vPrice],"Maverick",1);
}
}
return 1;
}
--------------------------------------------
|