Advertisement
erewefrfwfrewq

Untitled

Feb 10th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.56 KB | None | 0 0
  1. if(dialogid == DIALOG_NOSTOCK)
  2. {
  3. if(response)
  4. {
  5. hidePlayerDialog(playerid);
  6. BuyCar[playerid] = 0;
  7. }
  8. return 1;
  9. }
  10. if(dialogid == DIALOG_CARBUY5)
  11. {
  12. if(response)
  13. {
  14. new num = BuyCar[playerid];
  15. if(GetPlayerCash(playerid) >= Stock[num][vPrice])
  16. {
  17. if(Stock[num][vStock] > 0)
  18. {
  19. InsertCar(playerid,1,num);
  20. }
  21. else
  22. {
  23. new stringg[MAX_STRING];
  24. 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.");
  25. ShowPlayerDialog(playerid, DIALOG_NOSTOCK, DIALOG_STYLE_MSGBOX, "Out of stock", stringg, "Close","");
  26. }
  27. }
  28. else return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to purchase this vehicle.");
  29. }
  30. return 1;
  31. }
  32. if(dialogid == DIALOG_CARBUY2)
  33. {
  34. if(response)
  35. {
  36. new num = listitem + 1;
  37. BuyCar[playerid] = num;
  38. new string1[556],string2[556],string3[556],string4[556];
  39. SelectTextDraw(playerid, 0x478fcaFF);
  40. //string-uri
  41. format(string1, sizeof(string1), "Model:_~w~%s",Stock[num][vName]);
  42. PlayerTextDrawSetString(playerid, DSModel[playerid], string1);
  43. format(string2, sizeof(string2), "Pret:_~w~%s$",FormatNumber(Stock[num][vPrice]));
  44. PlayerTextDrawSetString(playerid, DSPrice[playerid], string2);
  45. format(string3, sizeof(string3), "Stock:_~w~%s",FormatNumber(Stock[num][vStock]));
  46. PlayerTextDrawSetString(playerid, DSStock[playerid], string3);
  47. format(string4, sizeof(string4), "Viteza Maxima:_~w~%skm/h",FormatNumber(Stock[num][vSpeed]));
  48. PlayerTextDrawSetString(playerid, DSSpeed[playerid], string4);
  49. //preview
  50. PlayerTextDrawSetPreviewModel(playerid, DSPrev[playerid], Stock[num][vModel]);
  51. PlayerTextDrawSetPreviewVehCol(playerid, DSPrev[playerid], 1, 1);
  52. //show
  53. PlayerTextDrawShow(playerid, DSBox1[playerid]);
  54. PlayerTextDrawShow(playerid, DSBox2[playerid]);
  55. PlayerTextDrawShow(playerid, DSBox3[playerid]);
  56. PlayerTextDrawShow(playerid, DSBox4[playerid]);
  57. PlayerTextDrawShow(playerid, DSModel[playerid]);
  58. PlayerTextDrawShow(playerid, DSPrice[playerid]);
  59. PlayerTextDrawShow(playerid, DSStock[playerid]);
  60. PlayerTextDrawShow(playerid, DSSpeed[playerid]);
  61. PlayerTextDrawShow(playerid, DSPrev[playerid]);
  62. PlayerTextDrawShow(playerid, DSBuy[playerid]);
  63. PlayerTextDrawShow(playerid, DSCancel[playerid]);
  64. }
  65. return 1;
  66. }
  67. if(dialogid == DIALOG_CARBUY3)
  68. {
  69. if(response)
  70. {
  71. new cheapcars;
  72. for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
  73. {
  74. if(Stock[xf][vType] == 1)
  75. {
  76. cheapcars = xf;
  77. }
  78. }
  79. new num = listitem + cheapcars + 1;
  80. BuyCar[playerid] = num;
  81. new string1[556],string2[556],string3[556],string4[556];
  82. SelectTextDraw(playerid, 0x478fcaFF);
  83. //string-uri
  84. format(string1, sizeof(string1), "Model:_~w~%s",Stock[num][vName]);
  85. PlayerTextDrawSetString(playerid, DSModel[playerid], string1);
  86. format(string2, sizeof(string2), "Pret:_~w~%s$",FormatNumber(Stock[num][vPrice]));
  87. PlayerTextDrawSetString(playerid, DSPrice[playerid], string2);
  88. format(string3, sizeof(string3), "Stock:_~w~%s",FormatNumber(Stock[num][vStock]));
  89. PlayerTextDrawSetString(playerid, DSStock[playerid], string3);
  90. format(string4, sizeof(string4), "Viteza Maxima:_~w~%skm/h",FormatNumber(Stock[num][vSpeed]));
  91. PlayerTextDrawSetString(playerid, DSSpeed[playerid], string4);
  92. //preview
  93. PlayerTextDrawSetPreviewModel(playerid, DSPrev[playerid], Stock[num][vModel]);
  94. PlayerTextDrawSetPreviewVehCol(playerid, DSPrev[playerid], 1, 1);
  95. //show
  96. PlayerTextDrawShow(playerid, DSBox1[playerid]);
  97. PlayerTextDrawShow(playerid, DSBox2[playerid]);
  98. PlayerTextDrawShow(playerid, DSBox3[playerid]);
  99. PlayerTextDrawShow(playerid, DSBox4[playerid]);
  100. PlayerTextDrawShow(playerid, DSModel[playerid]);
  101. PlayerTextDrawShow(playerid, DSPrice[playerid]);
  102. PlayerTextDrawShow(playerid, DSStock[playerid]);
  103. PlayerTextDrawShow(playerid, DSSpeed[playerid]);
  104. PlayerTextDrawShow(playerid, DSPrev[playerid]);
  105. PlayerTextDrawShow(playerid, DSBuy[playerid]);
  106. PlayerTextDrawShow(playerid, DSCancel[playerid]);
  107. }
  108. return 1;
  109. }
  110. if(dialogid == DIALOG_CARBUY4)
  111. {
  112. if(response)
  113. {
  114. new regcheapcars;
  115. for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
  116. {
  117. if(Stock[xf][vType] == 2)
  118. {
  119. regcheapcars = xf;
  120. }
  121. }
  122. new num = listitem + regcheapcars + 1;
  123. BuyCar[playerid] = num;
  124. new string1[556],string2[556],string3[556],string4[556];
  125. SelectTextDraw(playerid, 0x478fcaFF);
  126. //string-uri
  127. format(string1, sizeof(string1), "Model:_~w~%s",Stock[num][vName]);
  128. PlayerTextDrawSetString(playerid, DSModel[playerid], string1);
  129. format(string2, sizeof(string2), "Pret:_~w~%s$",FormatNumber(Stock[num][vPrice]));
  130. PlayerTextDrawSetString(playerid, DSPrice[playerid], string2);
  131. format(string3, sizeof(string3), "Stock:_~w~%s",FormatNumber(Stock[num][vStock]));
  132. PlayerTextDrawSetString(playerid, DSStock[playerid], string3);
  133. format(string4, sizeof(string4), "Viteza Maxima:_~w~%skm/h",FormatNumber(Stock[num][vSpeed]));
  134. PlayerTextDrawSetString(playerid, DSSpeed[playerid], string4);
  135. //preview
  136. PlayerTextDrawSetPreviewModel(playerid, DSPrev[playerid], Stock[num][vModel]);
  137. PlayerTextDrawSetPreviewVehCol(playerid, DSPrev[playerid], 1, 1);
  138. //show
  139. PlayerTextDrawShow(playerid, DSBox1[playerid]);
  140. PlayerTextDrawShow(playerid, DSBox2[playerid]);
  141. PlayerTextDrawShow(playerid, DSBox3[playerid]);
  142. PlayerTextDrawShow(playerid, DSBox4[playerid]);
  143. PlayerTextDrawShow(playerid, DSModel[playerid]);
  144. PlayerTextDrawShow(playerid, DSPrice[playerid]);
  145. PlayerTextDrawShow(playerid, DSStock[playerid]);
  146. PlayerTextDrawShow(playerid, DSSpeed[playerid]);
  147. PlayerTextDrawShow(playerid, DSPrev[playerid]);
  148. PlayerTextDrawShow(playerid, DSBuy[playerid]);
  149. PlayerTextDrawShow(playerid, DSCancel[playerid]);
  150. }
  151. return 1;
  152. }
  153. if(dialogid == DIALOG_CARBUY)
  154. {
  155. if(response)
  156. {
  157. if(listitem == 0)
  158. {
  159. new stringzz[10000],stringy[10000];
  160. for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
  161. {
  162. if(Stock[xf][vType] == 1)
  163. {
  164. 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]);
  165. strcat(stringzz,stringy);
  166. }
  167. }
  168. ShowPlayerDialog(playerid, DIALOG_CARBUY2, DIALOG_STYLE_LIST, "Buy a car", stringzz, "Select", "Close");
  169. }
  170. if(listitem == 1)
  171. {
  172. new stringzz[5556],stringy[5556];
  173. for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
  174. {
  175. if(Stock[xf][vType] == 2)
  176. {
  177. 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]);
  178. strcat(stringzz,stringy);
  179. }
  180. }
  181. ShowPlayerDialog(playerid, DIALOG_CARBUY3, DIALOG_STYLE_LIST, "Buy a car", stringzz, "Select", "Close");
  182. }
  183. if(listitem == 2)
  184. {
  185. new stringzz[5556],stringy[5556];
  186. for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++)
  187. {
  188. if(Stock[xf][vType] == 3)
  189. {
  190. 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]);
  191. strcat(stringzz,stringy);
  192. }
  193. }
  194. ShowPlayerDialog(playerid, DIALOG_CARBUY4, DIALOG_STYLE_LIST, "Buy a car", stringzz, "Select", "Close");
  195. }
  196. /*if(listitem == 3)
  197. {
  198. new string2[MAX_STRING];
  199. 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");
  200. ShowPlayerDialog(playerid, DIALOG_CARBUY8, DIALOG_STYLE_LIST, "Buy a car", string2, "Select", "Close");
  201. }*/
  202. }
  203. return 1;
  204. }
  205. if(dialogid == DIALOG_CARBUY8)
  206. {
  207. if(response)
  208. {
  209. if(listitem == 0)
  210. {
  211. if(PlayerInfo[playerid][pPremiumPoints] < 230) return SCM(playerid,COLOR_WHITE,"{FFB870}You don't have 230 premium points.");
  212. PlayerInfo[playerid][pPremiumPoints] -= 230;
  213. Update(playerid,pPremiumPointsx);
  214. InsertPCar(playerid,469,Stock[95][vPrice],"Sparrow",1);
  215. }
  216. if(listitem == 1)
  217. {
  218. if(PlayerInfo[playerid][pPremiumPoints] < 250) return SCM(playerid,COLOR_WHITE,"{FFB870}You don't have 250 premium points.");
  219. PlayerInfo[playerid][pPremiumPoints] -= 250;
  220. Update(playerid,pPremiumPointsx);
  221. InsertPCar(playerid,494,Stock[96][vPrice],"Hotring Racer",1);
  222. }
  223. if(listitem == 2)
  224. {
  225. if(PlayerInfo[playerid][pPremiumPoints] < 250) return SCM(playerid,COLOR_WHITE,"{FFB870}You don't have 250 premium points.");
  226. PlayerInfo[playerid][pPremiumPoints] -= 250;
  227. Update(playerid,pPremiumPointsx);
  228. InsertPCar(playerid,539,Stock[97][vPrice],"Vortex",1);
  229. }
  230. if(listitem == 3)
  231. {
  232. if(PlayerInfo[playerid][pPremiumPoints] < 250) return SCM(playerid,COLOR_WHITE,"{FFB870}You don't have 250 premium points.");
  233. PlayerInfo[playerid][pPremiumPoints] -= 250;
  234. Update(playerid,pPremiumPointsx);
  235. InsertPCar(playerid,502,Stock[98][vPrice],"Hotring Racer A",1);
  236. }
  237. if(listitem == 4)
  238. {
  239. if(PlayerInfo[playerid][pPremiumPoints] < 250) return SCM(playerid,COLOR_WHITE,"{FFB870}You don't have 250 premium points.");
  240. PlayerInfo[playerid][pPremiumPoints] -= 250;
  241. Update(playerid,pPremiumPointsx);
  242. InsertPCar(playerid,503,Stock[99][vPrice],"Hotring Racer B",1);
  243. }
  244. if(listitem == 5)
  245. {
  246. if(PlayerInfo[playerid][pPremiumPoints] < 300) return SCM(playerid,COLOR_WHITE,"{FFB870}You don't have 300 premium points.");
  247. PlayerInfo[playerid][pPremiumPoints] -= 300;
  248. Update(playerid,pPremiumPointsx);
  249. InsertPCar(playerid,487,Stock[100][vPrice],"Maverick",1);
  250. }
  251. }
  252. return 1;
  253. }
  254. if(dialogid == DIALOG_CARDAMAGE)
  255. {
  256. if(response)
  257. {
  258. new carid = GetPlayerVehicleID(playerid);
  259. if(carid == 0) return SCM(playerid,COLOR_WHITE,"You are not in vehicle.");
  260. new inscarp = CarInfo[OwnedVeh(carid)][cInscarprice];
  261. for(new v=0; v<MAX_PVEHS; v++)
  262. {
  263. if(carid == personalcar[v][playerid])
  264. {
  265. if (CarInfo[OwnedVeh(carid)][cInsurancecar] == 0)
  266. {
  267. if(GetPlayerCash(playerid) >= inscarp)
  268. {
  269. CarInfo[OwnedVeh(carid)][cInsurancecar] = 1;
  270. GivePlayerCash(playerid, - inscarp);
  271. Update(playerid,pCashx);
  272. vUpdate(OwnedVeh(carid),cInsurancecarx);
  273. return 1;
  274. }
  275. else
  276. {
  277. SendClientMessage(playerid, COLOR_WHITE, "{FFB870}** You don't have enough cash with you.");
  278. RemovePlayerFromVehicle(playerid);
  279. }
  280. }
  281. }
  282. else
  283. {
  284. SendClientMessage(playerid, COLOR_WHITE, "{FFB870}** This isn't your car.");
  285. RemovePlayerFromVehicle(playerid);
  286. }
  287. }
  288. }
  289. else return RemovePlayerFromVehicle(playerid);
  290. return 1;
  291. }
  292. if(dialogid == DIALOG_PLATE)
  293. {
  294. if(response)
  295. {
  296. new idcar = GetPlayerVehicleID(playerid);
  297. if(idcar == 0) return SCM(playerid,COLOR_WHITE,"{FFB870}You are not in vehicle.");
  298. SetVehicleNumberPlate(idcar,inputtext);
  299. new plate[25];
  300. mysql_real_escape_string(inputtext, plate);
  301. strmid(CarInfo[OwnedVeh(idcar)][cLicense], plate, 0, strlen(plate), 999);
  302. GivePlayerCash(playerid, - 15000);
  303. GameTextForPlayer(playerid, "~r~-15000", 5000, 1);
  304. Update(playerid, pCashx);
  305. vUpdate(OwnedVeh(idcar),cLicensex);
  306. }
  307. return 1;
  308. }
  309. if(dialogid == DIALOG_CARSELL)
  310. {
  311. if(response)
  312. {
  313. new idcar = GetPlayerVehicleID(playerid);
  314. new engine,lights,alarm,doors,bonnet,boot,objective;
  315. if(IsPlayerInVehicle(playerid,CarID[playerid]))
  316. {
  317. if(GetPlayerVehicleID(playerid) == CarID[playerid])
  318. {
  319. GetPlayerName(playerid, sendername, sizeof(sendername));
  320. if(strcmp(PlayerInfo[playerid][pNormalName], CarInfo[OwnedVeh(CarID[playerid])][cOwner], true) == 0)
  321. {
  322. if(PlayerInfo[playerid][pPcarkey] == OwnedVeh(CarID[playerid]))
  323. {
  324. PlayerInfo[playerid][pPcarkey] = 0;
  325. Update(playerid,pPcarkeyx);
  326. }
  327. else if(PlayerInfo[playerid][pmotokey] == OwnedVeh(CarID[playerid]))
  328. {
  329. PlayerInfo[playerid][pmotokey] = 0;
  330. Update(playerid,pmotokeyx);
  331. }
  332. else if(PlayerInfo[playerid][pprcarkey2] == OwnedVeh(CarID[playerid]))
  333. {
  334. PlayerInfo[playerid][pprcarkey2] = 0;
  335. Update(playerid,pprcarkey2x);
  336. }
  337. else if(PlayerInfo[playerid][pPPluscarkey] == OwnedVeh(CarID[playerid]))
  338. {
  339. PlayerInfo[playerid][pPPluscarkey] = 0;
  340. Update(playerid,pPPluscarkeyx);
  341. }
  342. else if(PlayerInfo[playerid][pPPluscarkey2] == OwnedVeh(CarID[playerid]))
  343. {
  344. PlayerInfo[playerid][pPPluscarkey2] = 0;
  345. Update(playerid,pPPluscarkey2x);
  346. }
  347. else if(PlayerInfo[playerid][pprcarkey] == OwnedVeh(CarID[playerid]))
  348. {
  349. PlayerInfo[playerid][pprcarkey] = 0;
  350. Update(playerid,pprcarkeyx);
  351. }
  352. vehEngine[idcar] = 0;
  353. GetVehicleParamsEx(idcar,engine,lights,alarm,doors,bonnet,boot,objective);
  354. SetVehicleParamsEx(idcar,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
  355. SetPVarInt(playerid, "Engine", 0);
  356. CarInfo[OwnedVeh(CarID[playerid])][cID] = -2;
  357. CarInfo[OwnedVeh(CarID[playerid])][cOwned] = 0;
  358. CarInfo[OwnedVeh(CarID[playerid])][cSell] = 2;
  359. strmid(CarInfo[OwnedVeh(CarID[playerid])][cOwner], "Dealership", 0, strlen("Dealership"), 999);
  360. vUpdate(OwnedVeh(CarID[playerid]),cOwnedx);
  361. vUpdate(OwnedVeh(CarID[playerid]),cOwnerx);
  362. vUpdate(OwnedVeh(CarID[playerid]),cSellx);
  363. DestroyVehicle(CarID[playerid]);
  364. TogglePlayerControllable(playerid, 1);
  365. new cashveh = floatround(floatmul(CarInfo[OwnedVeh(CarID[playerid])][cValue],0.60),floatround_ceil);
  366. GivePlayerCash(playerid, cashveh);
  367. format(string, sizeof(string), "{5CAD5C}* You have sold your car for $%s to state.",FormatNumber(cashveh));
  368. SendClientMessage(playerid, COLOR_WHITE, string);
  369. Update(playerid,pCashx);
  370. OwnedVeh(CarID[playerid]) = 0;
  371. CarID[playerid] = -1;
  372. new vvv = GetPlayerVehicleID(playerid);
  373. if(vvv == personalcar[0][playerid])
  374. personalcar[0][playerid] = 0;
  375. else if(vvv == personalcar[1][playerid])
  376. personalcar[1][playerid] = 0;
  377. else if(vvv == personalcar[2][playerid])
  378. personalcar[2][playerid] = 0;
  379. else if(vvv == personalcar[3][playerid])
  380. personalcar[3][playerid] = 0;
  381. else if(vvv == personalcar[4][playerid])
  382. personalcar[4][playerid] = 0;
  383. else if(vvv == personalcar[5][playerid])
  384. personalcar[5][playerid] = 0;
  385. }
  386. }
  387. else return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}This is not your car.");
  388. }
  389. else return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You have to sit at your own car to sell it.");
  390. }
  391. return 1;
  392. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement