SA-MP Forums Archive
Dealership bug? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dealership bug? (/showthread.php?tid=602557)



Dealership bug? - RiHn0 - 09.03.2016

Hello, I've got a new GM but it haves a little problem at dealership:
https://*********/6_qohUbyPX0

Somebody knows how to solve it please?


Re: Dealership bug? - xTURBOx - 09.03.2016

How are we suppose to help you without the code??


Re: Dealership bug? - RiHn0 - 09.03.2016

Here is the link from the initial GM. I think way is from the database but I don't know how to solve it... : http://www.girlshare.ro/35089940.6


Re: Dealership bug? - MicroKyrr - 09.03.2016

Quote:
Originally Posted by RiHn0
Посмотреть сообщение
Here is the link from the initial GM. I think way is from the database but I don't know how to solve it... : http://www.girlshare.ro/35089940.6
Pastebin please.


Re: Dealership bug? - Sew_Sumi - 09.03.2016

If you actually said what was wrong with it, rather than thinking people are psychic, then maybe someone would be able to say real fast. Posting up a video with you simply navigating a menu, then running down to a car that spawns, with the "Dealership bug?" title, really doesn't explain ANYTHING.

You are correct though it is likely to be in the database, especially where it has Dealership information.


Really though, you need to learn how to read and think about code.



Otherwise you need to find a gamemode that actually has proper documentation.


Re: Dealership bug? - RiHn0 - 12.03.2016

I found the code , this is all what I found about the DealerShip:

Quote:

---------------------------
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;
}
--------------------------------------------




Re: Dealership bug? - Sew_Sumi - 12.03.2016

You still haven't actually said what's wrong with it...

If it's to do with where the car is spawning, post up InsertPCar.