Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 nu mai 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 string1[556],string2[556],string3[556],string4[556];
- SelectTextDraw(playerid, 0x478fcaFF);
- //string-uri
- format(string1, sizeof(string1), "Model:_~w~%s",Stock[num][vName]);
- PlayerTextDrawSetString(playerid, DSModel[playerid], string1);
- format(string2, sizeof(string2), "Pret:_~w~%s$",FormatNumber(Stock[num][vPrice]));
- PlayerTextDrawSetString(playerid, DSPrice[playerid], string2);
- format(string3, sizeof(string3), "Stock:_~w~%s",FormatNumber(Stock[num][vStock]));
- PlayerTextDrawSetString(playerid, DSStock[playerid], string3);
- format(string4, sizeof(string4), "Viteza Maxima:_~w~%skm/h",FormatNumber(Stock[num][vSpeed]));
- PlayerTextDrawSetString(playerid, DSSpeed[playerid], string4);
- //preview
- PlayerTextDrawSetPreviewModel(playerid, DSPrev[playerid], Stock[num][vModel]);
- PlayerTextDrawSetPreviewVehCol(playerid, DSPrev[playerid], 1, 1);
- //show
- PlayerTextDrawShow(playerid, DSBox1[playerid]);
- PlayerTextDrawShow(playerid, DSBox2[playerid]);
- PlayerTextDrawShow(playerid, DSBox3[playerid]);
- PlayerTextDrawShow(playerid, DSBox4[playerid]);
- PlayerTextDrawShow(playerid, DSModel[playerid]);
- PlayerTextDrawShow(playerid, DSPrice[playerid]);
- PlayerTextDrawShow(playerid, DSStock[playerid]);
- PlayerTextDrawShow(playerid, DSSpeed[playerid]);
- PlayerTextDrawShow(playerid, DSPrev[playerid]);
- PlayerTextDrawShow(playerid, DSBuy[playerid]);
- PlayerTextDrawShow(playerid, DSCancel[playerid]);
- }
- return 1;
- }
- if(dialogid == DIALOG_CARBUY3)
- {
- if(response)
- {
- new cheapcars;
- for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
- {
- if(Stock[xf][vType] == 1)
- {
- cheapcars = xf;
- }
- }
- new num = listitem + cheapcars + 1;
- BuyCar[playerid] = num;
- new string1[556],string2[556],string3[556],string4[556];
- SelectTextDraw(playerid, 0x478fcaFF);
- //string-uri
- format(string1, sizeof(string1), "Model:_~w~%s",Stock[num][vName]);
- PlayerTextDrawSetString(playerid, DSModel[playerid], string1);
- format(string2, sizeof(string2), "Pret:_~w~%s$",FormatNumber(Stock[num][vPrice]));
- PlayerTextDrawSetString(playerid, DSPrice[playerid], string2);
- format(string3, sizeof(string3), "Stock:_~w~%s",FormatNumber(Stock[num][vStock]));
- PlayerTextDrawSetString(playerid, DSStock[playerid], string3);
- format(string4, sizeof(string4), "Viteza Maxima:_~w~%skm/h",FormatNumber(Stock[num][vSpeed]));
- PlayerTextDrawSetString(playerid, DSSpeed[playerid], string4);
- //preview
- PlayerTextDrawSetPreviewModel(playerid, DSPrev[playerid], Stock[num][vModel]);
- PlayerTextDrawSetPreviewVehCol(playerid, DSPrev[playerid], 1, 1);
- //show
- PlayerTextDrawShow(playerid, DSBox1[playerid]);
- PlayerTextDrawShow(playerid, DSBox2[playerid]);
- PlayerTextDrawShow(playerid, DSBox3[playerid]);
- PlayerTextDrawShow(playerid, DSBox4[playerid]);
- PlayerTextDrawShow(playerid, DSModel[playerid]);
- PlayerTextDrawShow(playerid, DSPrice[playerid]);
- PlayerTextDrawShow(playerid, DSStock[playerid]);
- PlayerTextDrawShow(playerid, DSSpeed[playerid]);
- PlayerTextDrawShow(playerid, DSPrev[playerid]);
- PlayerTextDrawShow(playerid, DSBuy[playerid]);
- PlayerTextDrawShow(playerid, DSCancel[playerid]);
- }
- return 1;
- }
- if(dialogid == DIALOG_CARBUY4)
- {
- if(response)
- {
- new regcheapcars;
- for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
- {
- if(Stock[xf][vType] == 2)
- {
- regcheapcars = xf;
- }
- }
- new num = listitem + regcheapcars + 1;
- BuyCar[playerid] = num;
- new string1[556],string2[556],string3[556],string4[556];
- SelectTextDraw(playerid, 0x478fcaFF);
- //string-uri
- format(string1, sizeof(string1), "Model:_~w~%s",Stock[num][vName]);
- PlayerTextDrawSetString(playerid, DSModel[playerid], string1);
- format(string2, sizeof(string2), "Pret:_~w~%s$",FormatNumber(Stock[num][vPrice]));
- PlayerTextDrawSetString(playerid, DSPrice[playerid], string2);
- format(string3, sizeof(string3), "Stock:_~w~%s",FormatNumber(Stock[num][vStock]));
- PlayerTextDrawSetString(playerid, DSStock[playerid], string3);
- format(string4, sizeof(string4), "Viteza Maxima:_~w~%skm/h",FormatNumber(Stock[num][vSpeed]));
- PlayerTextDrawSetString(playerid, DSSpeed[playerid], string4);
- //preview
- PlayerTextDrawSetPreviewModel(playerid, DSPrev[playerid], Stock[num][vModel]);
- PlayerTextDrawSetPreviewVehCol(playerid, DSPrev[playerid], 1, 1);
- //show
- PlayerTextDrawShow(playerid, DSBox1[playerid]);
- PlayerTextDrawShow(playerid, DSBox2[playerid]);
- PlayerTextDrawShow(playerid, DSBox3[playerid]);
- PlayerTextDrawShow(playerid, DSBox4[playerid]);
- PlayerTextDrawShow(playerid, DSModel[playerid]);
- PlayerTextDrawShow(playerid, DSPrice[playerid]);
- PlayerTextDrawShow(playerid, DSStock[playerid]);
- PlayerTextDrawShow(playerid, DSSpeed[playerid]);
- PlayerTextDrawShow(playerid, DSPrev[playerid]);
- PlayerTextDrawShow(playerid, DSBuy[playerid]);
- PlayerTextDrawShow(playerid, DSCancel[playerid]);
- }
- return 1;
- }
- if(dialogid == DIALOG_CARBUY)
- {
- if(response)
- {
- if(listitem == 0)
- {
- new stringzz[10000],stringy[10000];
- for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
- {
- if(Stock[xf][vType] == 1)
- {
- format(stringy, sizeof(stringy), "{ffffff}%s ( %d{33cc33}${ffffff} ) ( {00FFFF}%d {ffffff}cars 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[5556],stringy[5556];
- for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
- {
- if(Stock[xf][vType] == 2)
- {
- format(stringy, sizeof(stringy), "{ffffff}%s ( %d{33cc33}${ffffff} ) ( {00FFFF}%d {ffffff}cars 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[5556],stringy[5556];
- for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
- {
- if(Stock[xf][vType] == 3)
- {
- format(stringy, sizeof(stringy), "{ffffff}%s ( %d{33cc33}${ffffff} ) ( {00FFFF}%d {ffffff}cars 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_CARBUY8)
- {
- 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;
- }
- if(dialogid == DIALOG_CARDAMAGE)
- {
- if(response)
- {
- new carid = GetPlayerVehicleID(playerid);
- if(carid == 0) return SCM(playerid,COLOR_WHITE,"You are not in vehicle.");
- new inscarp = CarInfo[OwnedVeh(carid)][cInscarprice];
- for(new v=0; v<MAX_PVEHS; v++)
- {
- if(carid == personalcar[v][playerid])
- {
- if (CarInfo[OwnedVeh(carid)][cInsurancecar] == 0)
- {
- if(GetPlayerCash(playerid) >= inscarp)
- {
- CarInfo[OwnedVeh(carid)][cInsurancecar] = 1;
- GivePlayerCash(playerid, - inscarp);
- Update(playerid,pCashx);
- vUpdate(OwnedVeh(carid),cInsurancecarx);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "{FFB870}** You don't have enough cash with you.");
- RemovePlayerFromVehicle(playerid);
- }
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE, "{FFB870}** This isn't your car.");
- RemovePlayerFromVehicle(playerid);
- }
- }
- }
- else return RemovePlayerFromVehicle(playerid);
- return 1;
- }
- if(dialogid == DIALOG_PLATE)
- {
- if(response)
- {
- new idcar = GetPlayerVehicleID(playerid);
- if(idcar == 0) return SCM(playerid,COLOR_WHITE,"{FFB870}You are not in vehicle.");
- SetVehicleNumberPlate(idcar,inputtext);
- new plate[25];
- mysql_real_escape_string(inputtext, plate);
- strmid(CarInfo[OwnedVeh(idcar)][cLicense], plate, 0, strlen(plate), 999);
- GivePlayerCash(playerid, - 15000);
- GameTextForPlayer(playerid, "~r~-15000", 5000, 1);
- Update(playerid, pCashx);
- vUpdate(OwnedVeh(idcar),cLicensex);
- }
- return 1;
- }
- if(dialogid == DIALOG_CARSELL)
- {
- if(response)
- {
- new idcar = GetPlayerVehicleID(playerid);
- new engine,lights,alarm,doors,bonnet,boot,objective;
- if(IsPlayerInVehicle(playerid,CarID[playerid]))
- {
- if(GetPlayerVehicleID(playerid) == CarID[playerid])
- {
- GetPlayerName(playerid, sendername, sizeof(sendername));
- if(strcmp(PlayerInfo[playerid][pNormalName], CarInfo[OwnedVeh(CarID[playerid])][cOwner], true) == 0)
- {
- if(PlayerInfo[playerid][pPcarkey] == OwnedVeh(CarID[playerid]))
- {
- PlayerInfo[playerid][pPcarkey] = 0;
- Update(playerid,pPcarkeyx);
- }
- else if(PlayerInfo[playerid][pmotokey] == OwnedVeh(CarID[playerid]))
- {
- PlayerInfo[playerid][pmotokey] = 0;
- Update(playerid,pmotokeyx);
- }
- else if(PlayerInfo[playerid][pprcarkey2] == OwnedVeh(CarID[playerid]))
- {
- PlayerInfo[playerid][pprcarkey2] = 0;
- Update(playerid,pprcarkey2x);
- }
- else if(PlayerInfo[playerid][pPPluscarkey] == OwnedVeh(CarID[playerid]))
- {
- PlayerInfo[playerid][pPPluscarkey] = 0;
- Update(playerid,pPPluscarkeyx);
- }
- else if(PlayerInfo[playerid][pPPluscarkey2] == OwnedVeh(CarID[playerid]))
- {
- PlayerInfo[playerid][pPPluscarkey2] = 0;
- Update(playerid,pPPluscarkey2x);
- }
- else if(PlayerInfo[playerid][pprcarkey] == OwnedVeh(CarID[playerid]))
- {
- PlayerInfo[playerid][pprcarkey] = 0;
- Update(playerid,pprcarkeyx);
- }
- vehEngine[idcar] = 0;
- GetVehicleParamsEx(idcar,engine,lights,alarm,doors,bonnet,boot,objective);
- SetVehicleParamsEx(idcar,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
- SetPVarInt(playerid, "Engine", 0);
- CarInfo[OwnedVeh(CarID[playerid])][cID] = -2;
- CarInfo[OwnedVeh(CarID[playerid])][cOwned] = 0;
- CarInfo[OwnedVeh(CarID[playerid])][cSell] = 2;
- strmid(CarInfo[OwnedVeh(CarID[playerid])][cOwner], "Dealership", 0, strlen("Dealership"), 999);
- vUpdate(OwnedVeh(CarID[playerid]),cOwnedx);
- vUpdate(OwnedVeh(CarID[playerid]),cOwnerx);
- vUpdate(OwnedVeh(CarID[playerid]),cSellx);
- DestroyVehicle(CarID[playerid]);
- TogglePlayerControllable(playerid, 1);
- new cashveh = floatround(floatmul(CarInfo[OwnedVeh(CarID[playerid])][cValue],0.60),floatround_ceil);
- GivePlayerCash(playerid, cashveh);
- format(string, sizeof(string), "{5CAD5C}* You have sold your car for $%s to state.",FormatNumber(cashveh));
- SendClientMessage(playerid, COLOR_WHITE, string);
- Update(playerid,pCashx);
- OwnedVeh(CarID[playerid]) = 0;
- CarID[playerid] = -1;
- new vvv = GetPlayerVehicleID(playerid);
- if(vvv == personalcar[0][playerid])
- personalcar[0][playerid] = 0;
- else if(vvv == personalcar[1][playerid])
- personalcar[1][playerid] = 0;
- else if(vvv == personalcar[2][playerid])
- personalcar[2][playerid] = 0;
- else if(vvv == personalcar[3][playerid])
- personalcar[3][playerid] = 0;
- else if(vvv == personalcar[4][playerid])
- personalcar[4][playerid] = 0;
- else if(vvv == personalcar[5][playerid])
- personalcar[5][playerid] = 0;
- }
- }
- else return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}This is not your car.");
- }
- else return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You have to sit at your own car to sell it.");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement