Advertisement
Guest User

Untitled

a guest
Mar 5th, 2017
621
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 47.67 KB | None | 0 0
  1. // type 1 - car | 2 - moto/bike | 3 - heli | 4 - premium cars.
  2. public InsertCar(playerid,type,stockid)
  3. {
  4. new string[128],sendername[25],namecar[100];
  5. new idd = Findcar();
  6. new model = Stock[stockid][vModel];
  7. new value = Stock[stockid][vPrice];
  8. strmid(namecar,Stock[stockid][vName], 0, 100, 255);
  9. GetPlayerName(playerid,sendername,sizeof(sendername));
  10. BuyCar[playerid] = -1;
  11. if(idd != 0)
  12. {
  13. if(GetPlayerCash(playerid) < value) return SCM(playerid,COLOR_WHITE,"{FFB870}You do not have enough money.");
  14. if(type == 1)
  15. {
  16. if(PlayerInfo[playerid][pPremiumAccount] == 0 && PlayerInfo[playerid][pPlusSlot1] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
  17. {
  18. if(PlayerInfo[playerid][pPcarkey] == 0)
  19. {
  20. PlayerInfo[playerid][pPcarkey] = idd;
  21. Update(playerid,pPcarkeyx);
  22. CarInfo[idd][cLocationx] = 284.5032;
  23. CarInfo[idd][cLocationy] = -1526.4036;
  24. CarInfo[idd][cLocationz] = 24.3208;
  25. CarInfo[idd][cAngle] = 235.1191;
  26. }
  27. else
  28. {
  29. if(PlayerInfo[playerid][pmotokey] == 0)
  30. {
  31. PlayerInfo[playerid][pmotokey] = idd;
  32. Update(playerid,pmotokeyx);
  33. CarInfo[idd][cLocationx] = 284.5032;
  34. CarInfo[idd][cLocationy] = -1526.4036;
  35. CarInfo[idd][cLocationz] = 24.3208;
  36. CarInfo[idd][cAngle] = 235.1191;
  37. }
  38. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars.");
  39. }
  40. }
  41. if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPremiumAccount] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
  42. {
  43. if(PlayerInfo[playerid][pPcarkey] == 0)
  44. {
  45. PlayerInfo[playerid][pPcarkey] = idd;
  46. Update(playerid,pPcarkeyx);
  47. CarInfo[idd][cLocationx] = 284.5032;
  48. CarInfo[idd][cLocationy] = -1526.4036;
  49. CarInfo[idd][cLocationz] = 24.3208;
  50. CarInfo[idd][cAngle] = 235.1191;
  51. }
  52. else
  53. {
  54. if(PlayerInfo[playerid][pmotokey] == 0)
  55. {
  56. PlayerInfo[playerid][pmotokey] = idd;
  57. Update(playerid,pmotokeyx);
  58. CarInfo[idd][cLocationx] = 284.5032;
  59. CarInfo[idd][cLocationy] = -1526.4036;
  60. CarInfo[idd][cLocationz] = 24.3208;
  61. CarInfo[idd][cAngle] = 235.1191;
  62. }
  63. else if(PlayerInfo[playerid][pPPluscarkey] == 0)
  64. {
  65. PlayerInfo[playerid][pPPluscarkey] = idd;
  66. Update(playerid,pPPluscarkeyx);
  67. CarInfo[idd][cLocationx] = 284.5032;
  68. CarInfo[idd][cLocationy] = -1526.4036;
  69. CarInfo[idd][cLocationz] = 24.3208;
  70. CarInfo[idd][cAngle] = 235.1191;
  71. }
  72. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 1 plus car.");
  73. }
  74. }
  75. if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 1 && PlayerInfo[playerid][pPremiumAccount] == 0)
  76. {
  77. if(PlayerInfo[playerid][pPcarkey] == 0)
  78. {
  79. PlayerInfo[playerid][pPcarkey] = idd;
  80. Update(playerid,pPcarkeyx);
  81. CarInfo[idd][cLocationx] = 284.5032;
  82. CarInfo[idd][cLocationy] = -1526.4036;
  83. CarInfo[idd][cLocationz] = 24.3208;
  84. CarInfo[idd][cAngle] = 235.1191;
  85. }
  86. else
  87. {
  88. if(PlayerInfo[playerid][pmotokey] == 0)
  89. {
  90. PlayerInfo[playerid][pmotokey] = idd;
  91. Update(playerid,pmotokeyx);
  92. CarInfo[idd][cLocationx] = 284.5032;
  93. CarInfo[idd][cLocationy] = -1526.4036;
  94. CarInfo[idd][cLocationz] = 24.3208;
  95. CarInfo[idd][cAngle] = 235.1191;
  96. }
  97. else if(PlayerInfo[playerid][pPPluscarkey] == 0)
  98. {
  99. PlayerInfo[playerid][pPPluscarkey] = idd;
  100. Update(playerid,pPPluscarkeyx);
  101. CarInfo[idd][cLocationx] = 284.5032;
  102. CarInfo[idd][cLocationy] = -1526.4036;
  103. CarInfo[idd][cLocationz] = 24.3208;
  104. CarInfo[idd][cAngle] = 235.1191;
  105. }
  106. else if(PlayerInfo[playerid][pPPluscarkey2] == 0)
  107. {
  108. PlayerInfo[playerid][pPPluscarkey2] = idd;
  109. Update(playerid,pPPluscarkey2x);
  110. CarInfo[idd][cLocationx] = 284.5032;
  111. CarInfo[idd][cLocationy] = -1526.4036;
  112. CarInfo[idd][cLocationz] = 24.3208;
  113. CarInfo[idd][cAngle] = 235.1191;
  114. }
  115. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 plus cars.");
  116. }
  117. }
  118. if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 0 && PlayerInfo[playerid][pPremiumAccount] > 0)
  119. {
  120. if(PlayerInfo[playerid][pPcarkey] == 0)
  121. {
  122. PlayerInfo[playerid][pPcarkey] = idd;
  123. Update(playerid,pPcarkeyx);
  124. CarInfo[idd][cLocationx] = 284.5032;
  125. CarInfo[idd][cLocationy] = -1526.4036;
  126. CarInfo[idd][cLocationz] = 24.3208;
  127. CarInfo[idd][cAngle] = 235.1191;
  128. }
  129. else
  130. {
  131. if(PlayerInfo[playerid][pmotokey] == 0)
  132. {
  133. PlayerInfo[playerid][pmotokey] = idd;
  134. Update(playerid,pmotokeyx);
  135. CarInfo[idd][cLocationx] = 284.5032;
  136. CarInfo[idd][cLocationy] = -1526.4036;
  137. CarInfo[idd][cLocationz] = 24.3208;
  138. CarInfo[idd][cAngle] = 235.1191;
  139. }
  140. else if(PlayerInfo[playerid][pprcarkey] == 0)
  141. {
  142. PlayerInfo[playerid][pprcarkey] = idd;
  143. Update(playerid,pprcarkeyx);
  144. CarInfo[idd][cLocationx] = 284.5032;
  145. CarInfo[idd][cLocationy] = -1526.4036;
  146. CarInfo[idd][cLocationz] = 24.3208;
  147. CarInfo[idd][cAngle] = 235.1191;
  148. }
  149. else if(PlayerInfo[playerid][pprcarkey2] == 0)
  150. {
  151. PlayerInfo[playerid][pprcarkey2] = idd;
  152. Update(playerid,pprcarkey2x);
  153. CarInfo[idd][cLocationx] = 284.5032;
  154. CarInfo[idd][cLocationy] = -1526.4036;
  155. CarInfo[idd][cLocationz] = 24.3208;
  156. CarInfo[idd][cAngle] = 235.1191;
  157. }
  158. else if(PlayerInfo[playerid][pPPluscarkey] == 0)
  159. {
  160. PlayerInfo[playerid][pPPluscarkey] = idd;
  161. Update(playerid,pPPluscarkeyx);
  162. CarInfo[idd][cLocationx] = 284.5032;
  163. CarInfo[idd][cLocationy] = -1526.4036;
  164. CarInfo[idd][cLocationz] = 24.3208;
  165. CarInfo[idd][cAngle] = 235.1191;
  166. }
  167. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 premium cars + 1 plus car.");
  168. }
  169. }
  170. if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 1 && PlayerInfo[playerid][pPremiumAccount] > 0)
  171. {
  172. if(PlayerInfo[playerid][pPcarkey] == 0)
  173. {
  174. PlayerInfo[playerid][pPcarkey] = idd;
  175. Update(playerid,pPcarkeyx);
  176. CarInfo[idd][cLocationx] = 284.5032;
  177. CarInfo[idd][cLocationy] = -1526.4036;
  178. CarInfo[idd][cLocationz] = 24.3208;
  179. CarInfo[idd][cAngle] = 235.1191;
  180. }
  181. else
  182. {
  183. if(PlayerInfo[playerid][pmotokey] == 0)
  184. {
  185. PlayerInfo[playerid][pmotokey] = idd;
  186. Update(playerid,pmotokeyx);
  187. CarInfo[idd][cLocationx] = 284.5032;
  188. CarInfo[idd][cLocationy] = -1526.4036;
  189. CarInfo[idd][cLocationz] = 24.3208;
  190. CarInfo[idd][cAngle] = 235.1191;
  191. }
  192. else if(PlayerInfo[playerid][pprcarkey] == 0)
  193. {
  194. PlayerInfo[playerid][pprcarkey] = idd;
  195. Update(playerid,pprcarkeyx);
  196. CarInfo[idd][cLocationx] = 284.5032;
  197. CarInfo[idd][cLocationy] = -1526.4036;
  198. CarInfo[idd][cLocationz] = 24.3208;
  199. CarInfo[idd][cAngle] = 235.1191;
  200. }
  201. else if(PlayerInfo[playerid][pprcarkey2] == 0)
  202. {
  203. PlayerInfo[playerid][pprcarkey2] = idd;
  204. Update(playerid,pprcarkey2x);
  205. CarInfo[idd][cLocationx] = 284.5032;
  206. CarInfo[idd][cLocationy] = -1526.4036;
  207. CarInfo[idd][cLocationz] = 24.3208;
  208. CarInfo[idd][cAngle] = 235.1191;
  209. }
  210. else if(PlayerInfo[playerid][pPPluscarkey] == 0)
  211. {
  212. PlayerInfo[playerid][pPPluscarkey] = idd;
  213. Update(playerid,pPPluscarkeyx);
  214. CarInfo[idd][cLocationx] = 284.5032;
  215. CarInfo[idd][cLocationy] = -1526.4036;
  216. CarInfo[idd][cLocationz] = 24.3208;
  217. CarInfo[idd][cAngle] = 235.1191;
  218. }
  219. else if(PlayerInfo[playerid][pPPluscarkey2] == 0)
  220. {
  221. PlayerInfo[playerid][pPPluscarkey2] = idd;
  222. Update(playerid,pPPluscarkey2x);
  223. CarInfo[idd][cLocationx] = 284.5032;
  224. CarInfo[idd][cLocationy] = -1526.4036;
  225. CarInfo[idd][cLocationz] = 24.3208;
  226. CarInfo[idd][cAngle] = 235.1191;
  227. }
  228. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 premium cars + 2 plus cars.");
  229. }
  230. }
  231. if(PlayerInfo[playerid][pPremiumAccount] > 0 && PlayerInfo[playerid][pPlusSlot1] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
  232. {
  233. if(PlayerInfo[playerid][pPcarkey] == 0)
  234. {
  235. PlayerInfo[playerid][pPcarkey] = idd;
  236. Update(playerid,pPcarkeyx);
  237. CarInfo[idd][cLocationx] = 284.5032;
  238. CarInfo[idd][cLocationy] = -1526.4036;
  239. CarInfo[idd][cLocationz] = 24.3208;
  240. CarInfo[idd][cAngle] = 235.1191;
  241. }
  242. else
  243. {
  244. if(PlayerInfo[playerid][pmotokey] == 0)
  245. {
  246. PlayerInfo[playerid][pmotokey] = idd;
  247. Update(playerid,pmotokeyx);
  248. CarInfo[idd][cLocationx] = 284.5032;
  249. CarInfo[idd][cLocationy] = -1526.4036;
  250. CarInfo[idd][cLocationz] = 24.3208;
  251. CarInfo[idd][cAngle] = 235.1191;
  252. }
  253. else if(PlayerInfo[playerid][pprcarkey] == 0)
  254. {
  255. PlayerInfo[playerid][pprcarkey] = idd;
  256. Update(playerid,pprcarkeyx);
  257. CarInfo[idd][cLocationx] = 284.5032;
  258. CarInfo[idd][cLocationy] = -1526.4036;
  259. CarInfo[idd][cLocationz] = 24.3208;
  260. CarInfo[idd][cAngle] = 235.1191;
  261. }
  262. else if(PlayerInfo[playerid][pprcarkey2] == 0)
  263. {
  264. PlayerInfo[playerid][pprcarkey2] = idd;
  265. Update(playerid,pprcarkey2x);
  266. CarInfo[idd][cLocationx] = 284.5032;
  267. CarInfo[idd][cLocationy] = -1526.4036;
  268. CarInfo[idd][cLocationz] = 24.3208;
  269. CarInfo[idd][cAngle] = 235.1191;
  270. }
  271. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 premium cars + 2 cars.");
  272. }
  273. }
  274. }
  275.  
  276. Stock[stockid][vStock]--;
  277. mysql_format(SQL, string, sizeof(string), "UPDATE stock SET Stock='%d' WHERE ID='%d'", Stock[stockid][vStock],stockid);
  278. mysql_tquery(SQL,string,"","");
  279.  
  280. GivePlayerCash(playerid,-value);
  281. Update(playerid,pCashx);
  282.  
  283. CarInfo[idd][cSell] = 1;
  284. CarInfo[idd][cID] = idd;
  285. CarInfo[idd][cModel] = model;
  286.  
  287. foreach(Player, x)
  288. {
  289. if(PlayerInfo[x][pAdminLevel] >= 6)
  290. {
  291. new szMessage[1024];
  292. format(szMessage, sizeof(szMessage),"%s", PlayerInfo[x][pNormalName]);
  293. CarInfo[idd][cObject] = CreateObject(19327, -2597.0762, -2638.4270, -5.3536, -87.6999, 90.4001, -87.1805);
  294. SetObjectMaterialText(CarInfo[idd][cObject], szMessage, 0, 50, "Arial", 25, 1, 0xFFFFFFFF, 0, 1);
  295. AttachObjectToVehicle(CarInfo[idd][cObject], idd, 0.0,-1.9, 0.3, 270.0, 0.0, 0.0);
  296. CarInfo[idd][cText] = szMessage;
  297. }
  298. }
  299. CarInfo[idd][cColorOne] = 1;
  300. CarInfo[idd][cColorTwo] = 1;
  301. strmid(CarInfo[idd][cOwner], PlayerInfo[playerid][pNormalName], 0, 25, 255);
  302. strmid(CarInfo[idd][cDescription],namecar, 0, strlen(namecar), 255);
  303. CarInfo[idd][cValue] = value;
  304. strmid(CarInfo[idd][cLicense], "NewCar", 0, 6, 255);
  305. CarInfo[idd][cOwned] = 1;
  306. CarInfo[idd][cLock] = 0;
  307. CarInfo[idd][cTimed] = 0;
  308. CarInfo[idd][cInscarprice] = 100;
  309. CarInfo[idd][cInsurancecar] = 4;
  310. CarInfo[idd][cKM] = 0.0;
  311. CarInfo[idd][cHP] = 1000.0;
  312. CarInfo[idd][cDamage1] = 0;
  313. CarInfo[idd][cDamage2] = 0;
  314. CarInfo[idd][cDamage3] = 0;
  315. CarInfo[idd][cDamage4] = 0;
  316. CarInfo[idd][cGas] = 100;
  317. CarInfo[idd][cPaintJ] = 6;
  318. CarInfo[idd][mod1] = 0;
  319. CarInfo[idd][mod2] = 0;
  320. CarInfo[idd][mod3] = 0;
  321. CarInfo[idd][mod4] = 0;
  322. CarInfo[idd][mod5] = 0;
  323. CarInfo[idd][mod6] = 0;
  324. CarInfo[idd][mod7] = 0;
  325. CarInfo[idd][mod8] = 0;
  326. CarInfo[idd][mod9] = 0;
  327. CarInfo[idd][mod10] = 0;
  328. CarInfo[idd][mod11] = 0;
  329. CarInfo[idd][mod12] = 0;
  330. CarInfo[idd][mod13] = 0;
  331. CarInfo[idd][mod14] = 0;
  332. CarInfo[idd][mod15] = 0;
  333. CarInfo[idd][mod16] = 0;
  334. CarInfo[idd][mod17] = 0;
  335. CarInfo[idd][cDays] = 0;
  336.  
  337. vUpdate(idd, cModsx);
  338. vUpdate(idd, cPaintJx);
  339. vUpdate(idd, cSellx);
  340. vUpdate(idd, cLocationxx);
  341. vUpdate(idd, cLocationyx);
  342. vUpdate(idd, cLocationzx);
  343. vUpdate(idd, cAnglex);
  344. vUpdate(idd, cModelx);
  345. vUpdate(idd, cColorOnex);
  346. vUpdate(idd, cColorTwox);
  347. vUpdate(idd, cOwnerx);
  348. vUpdate(idd, cValuex);
  349. vUpdate(idd, cLicensex);
  350. vUpdate(idd, cDescriptionx);
  351. vUpdate(idd, cLockx);
  352. vUpdate(idd, cTimedx);
  353. vUpdate(idd, cInscarpricex);
  354. vUpdate(idd, cInsurancecarx);
  355. vUpdate(idd, cKMx);
  356. vUpdate(idd, cOwnedx);
  357. vUpdate(idd, cDaysx);
  358. vUpdate(idd, cHPx);
  359. vUpdate(idd, cDamage1x);
  360. vUpdate(idd, cDamage2x);
  361. vUpdate(idd, cDamage3x);
  362. vUpdate(idd, cDamage4x);
  363. vUpdate(idd, cGasx);
  364.  
  365. new car = CreateVehicle(CarInfo[idd][cModel],CarInfo[idd][cLocationx],CarInfo[idd][cLocationy],CarInfo[idd][cLocationz],CarInfo[idd][cAngle],1,1,500000);
  366. SetVehicleNumberPlate(car,CarInfo[idd][cLicense]);
  367.  
  368. new disp[184],stringsss[256],numele[30];
  369. format(disp,sizeof(disp),"You bought %s.Please take your car and park it elsewhere.",CarInfo[idd][cDescription]);
  370. SCM(playerid,COLOR_LIGHTBLUE,disp);
  371. GetPlayerName(playerid, numele, sizeof(numele));
  372. format(stringsss,sizeof(stringsss),"%s [user:%d] bought a %s [car:%d] for $%s.",numele,PlayerInfo[playerid][pSQLID],CarInfo[idd][cDescription],CarInfo[idd][cID],FormatNumber(value));
  373. ShowAdmins(COLOR_YELLOW,stringsss,1);
  374. new var100[256],y,m,d,h,mi,s,string2[256],string3[256];
  375. getdate(y,m,d);
  376. gettime(h,mi,s);
  377. format(string2,sizeof(string2),"[%02d-%02d-%d %02d:%02d:%02d] %s",d,m,y,h,mi,s,stringsss);
  378. mysql_real_escape_string(string2, string3);
  379. mysql_format(SQL, var100, sizeof(var100), "INSERT INTO playerlogs (`playerid`,`giverid`,`action`,`time`) VALUES ('%d','0','%s','%02d-%02d-%d %02d:%02d:%02d')", PlayerInfo[playerid][pSQLID],string3,d,m,y,h,mi,s);
  380. mysql_tquery(SQL,var100,"","");
  381.  
  382. OwnedVeh(car) = idd;
  383. if(idd == PlayerInfo[playerid][pPcarkey])
  384. {
  385. personalcar[0][playerid] = car;
  386. }
  387. if(idd == PlayerInfo[playerid][pmotokey])
  388. {
  389. personalcar[1][playerid] = car;
  390. }
  391. if(idd == PlayerInfo[playerid][pprcarkey])
  392. {
  393. personalcar[2][playerid] = car;
  394. }
  395. if(idd == PlayerInfo[playerid][pprcarkey2])
  396. {
  397. personalcar[3][playerid] = car;
  398. }
  399. if(idd == PlayerInfo[playerid][pPPluscarkey])
  400. {
  401. personalcar[4][playerid] = car;
  402. }
  403. if(idd == PlayerInfo[playerid][pPPluscarkey2])
  404. {
  405. personalcar[5][playerid] = car;
  406. }
  407. masini++;
  408. SwitchKey[playerid] = 1;
  409. }
  410. if(idd == 0)
  411. {
  412. if(GetPlayerCash(playerid) < value) return SCM(playerid,COLOR_WHITE,"{FFB870}You do not have enough money.");
  413.  
  414. new Cache: sar = mysql_query(SQL,"SELECT * FROM `cars`");
  415. idd = cache_num_rows()+1;
  416. cache_delete(sar);
  417.  
  418. if(type == 1)
  419. {
  420. if(PlayerInfo[playerid][pPremiumAccount] == 0 && PlayerInfo[playerid][pPlusSlot1] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
  421. {
  422. if(PlayerInfo[playerid][pPcarkey] == 0)
  423. {
  424. PlayerInfo[playerid][pPcarkey] = idd;
  425. Update(playerid,pPcarkeyx);
  426. CarInfo[idd][cLocationx] = 284.5032;
  427. CarInfo[idd][cLocationy] = -1526.4036;
  428. CarInfo[idd][cLocationz] = 24.3208;
  429. CarInfo[idd][cAngle] = 235.1191;
  430. }
  431. else
  432. {
  433. if(PlayerInfo[playerid][pmotokey] == 0)
  434. {
  435. PlayerInfo[playerid][pmotokey] = idd;
  436. Update(playerid,pmotokeyx);
  437. CarInfo[idd][cLocationx] = 284.5032;
  438. CarInfo[idd][cLocationy] = -1526.4036;
  439. CarInfo[idd][cLocationz] = 24.3208;
  440. CarInfo[idd][cAngle] = 235.1191;
  441. }
  442. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars.");
  443. }
  444. }
  445. if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPremiumAccount] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
  446. {
  447. if(PlayerInfo[playerid][pPcarkey] == 0)
  448. {
  449. PlayerInfo[playerid][pPcarkey] = idd;
  450. Update(playerid,pPcarkeyx);
  451. CarInfo[idd][cLocationx] = 284.5032;
  452. CarInfo[idd][cLocationy] = -1526.4036;
  453. CarInfo[idd][cLocationz] = 24.3208;
  454. CarInfo[idd][cAngle] = 235.1191;
  455. }
  456. else
  457. {
  458. if(PlayerInfo[playerid][pmotokey] == 0)
  459. {
  460. PlayerInfo[playerid][pmotokey] = idd;
  461. Update(playerid,pmotokeyx);
  462. CarInfo[idd][cLocationx] = 284.5032;
  463. CarInfo[idd][cLocationy] = -1526.4036;
  464. CarInfo[idd][cLocationz] = 24.3208;
  465. CarInfo[idd][cAngle] = 235.1191;
  466. }
  467. else if(PlayerInfo[playerid][pPPluscarkey] == 0)
  468. {
  469. PlayerInfo[playerid][pPPluscarkey] = idd;
  470. Update(playerid,pPPluscarkeyx);
  471. CarInfo[idd][cLocationx] = 284.5032;
  472. CarInfo[idd][cLocationy] = -1526.4036;
  473. CarInfo[idd][cLocationz] = 24.3208;
  474. CarInfo[idd][cAngle] = 235.1191;
  475. }
  476. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 1 plus car.");
  477. }
  478. }
  479. if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 1 && PlayerInfo[playerid][pPremiumAccount] == 0)
  480. {
  481. if(PlayerInfo[playerid][pPcarkey] == 0)
  482. {
  483. PlayerInfo[playerid][pPcarkey] = idd;
  484. Update(playerid,pPcarkeyx);
  485. CarInfo[idd][cLocationx] = 284.5032;
  486. CarInfo[idd][cLocationy] = -1526.4036;
  487. CarInfo[idd][cLocationz] = 24.3208;
  488. CarInfo[idd][cAngle] = 235.1191;
  489. }
  490. else
  491. {
  492. if(PlayerInfo[playerid][pmotokey] == 0)
  493. {
  494. PlayerInfo[playerid][pmotokey] = idd;
  495. Update(playerid,pmotokeyx);
  496. CarInfo[idd][cLocationx] = 284.5032;
  497. CarInfo[idd][cLocationy] = -1526.4036;
  498. CarInfo[idd][cLocationz] = 24.3208;
  499. CarInfo[idd][cAngle] = 235.1191;
  500. }
  501. else if(PlayerInfo[playerid][pPPluscarkey] == 0)
  502. {
  503. PlayerInfo[playerid][pPPluscarkey] = idd;
  504. Update(playerid,pPPluscarkeyx);
  505. CarInfo[idd][cLocationx] = 284.5032;
  506. CarInfo[idd][cLocationy] = -1526.4036;
  507. CarInfo[idd][cLocationz] = 24.3208;
  508. CarInfo[idd][cAngle] = 235.1191;
  509. }
  510. else if(PlayerInfo[playerid][pPPluscarkey2] == 0)
  511. {
  512. PlayerInfo[playerid][pPPluscarkey2] = idd;
  513. Update(playerid,pPPluscarkey2x);
  514. CarInfo[idd][cLocationx] = 284.5032;
  515. CarInfo[idd][cLocationy] = -1526.4036;
  516. CarInfo[idd][cLocationz] = 24.3208;
  517. CarInfo[idd][cAngle] = 235.1191;
  518. }
  519. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 plus cars.");
  520. }
  521. }
  522. if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 0 && PlayerInfo[playerid][pPremiumAccount] > 0)
  523. {
  524. if(PlayerInfo[playerid][pPcarkey] == 0)
  525. {
  526. PlayerInfo[playerid][pPcarkey] = idd;
  527. Update(playerid,pPcarkeyx);
  528. CarInfo[idd][cLocationx] = 284.5032;
  529. CarInfo[idd][cLocationy] = -1526.4036;
  530. CarInfo[idd][cLocationz] = 24.3208;
  531. CarInfo[idd][cAngle] = 235.1191;
  532. }
  533. else
  534. {
  535. if(PlayerInfo[playerid][pmotokey] == 0)
  536. {
  537. PlayerInfo[playerid][pmotokey] = idd;
  538. Update(playerid,pmotokeyx);
  539. CarInfo[idd][cLocationx] = 284.5032;
  540. CarInfo[idd][cLocationy] = -1526.4036;
  541. CarInfo[idd][cLocationz] = 24.3208;
  542. CarInfo[idd][cAngle] = 235.1191;
  543. }
  544. else if(PlayerInfo[playerid][pprcarkey] == 0)
  545. {
  546. PlayerInfo[playerid][pprcarkey] = idd;
  547. Update(playerid,pprcarkeyx);
  548. CarInfo[idd][cLocationx] = 284.5032;
  549. CarInfo[idd][cLocationy] = -1526.4036;
  550. CarInfo[idd][cLocationz] = 24.3208;
  551. CarInfo[idd][cAngle] = 235.1191;
  552. }
  553. else if(PlayerInfo[playerid][pprcarkey2] == 0)
  554. {
  555. PlayerInfo[playerid][pprcarkey2] = idd;
  556. Update(playerid,pprcarkey2x);
  557. CarInfo[idd][cLocationx] = 284.5032;
  558. CarInfo[idd][cLocationy] = -1526.4036;
  559. CarInfo[idd][cLocationz] = 24.3208;
  560. CarInfo[idd][cAngle] = 235.1191;
  561. }
  562. else if(PlayerInfo[playerid][pPPluscarkey] == 0)
  563. {
  564. PlayerInfo[playerid][pPPluscarkey] = idd;
  565. Update(playerid,pPPluscarkeyx);
  566. CarInfo[idd][cLocationx] = 284.5032;
  567. CarInfo[idd][cLocationy] = -1526.4036;
  568. CarInfo[idd][cLocationz] = 24.3208;
  569. CarInfo[idd][cAngle] = 235.1191;
  570. }
  571. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 premium cars + 1 plus car.");
  572. }
  573. }
  574. if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 1 && PlayerInfo[playerid][pPremiumAccount] > 0)
  575. {
  576. if(PlayerInfo[playerid][pPcarkey] == 0)
  577. {
  578. PlayerInfo[playerid][pPcarkey] = idd;
  579. Update(playerid,pPcarkeyx);
  580. CarInfo[idd][cLocationx] = 284.5032;
  581. CarInfo[idd][cLocationy] = -1526.4036;
  582. CarInfo[idd][cLocationz] = 24.3208;
  583. CarInfo[idd][cAngle] = 235.1191;
  584. }
  585. else
  586. {
  587. if(PlayerInfo[playerid][pmotokey] == 0)
  588. {
  589. PlayerInfo[playerid][pmotokey] = idd;
  590. Update(playerid,pmotokeyx);
  591. CarInfo[idd][cLocationx] = 284.5032;
  592. CarInfo[idd][cLocationy] = -1526.4036;
  593. CarInfo[idd][cLocationz] = 24.3208;
  594. CarInfo[idd][cAngle] = 235.1191;
  595. }
  596. else if(PlayerInfo[playerid][pprcarkey] == 0)
  597. {
  598. PlayerInfo[playerid][pprcarkey] = idd;
  599. Update(playerid,pprcarkeyx);
  600. CarInfo[idd][cLocationx] = 284.5032;
  601. CarInfo[idd][cLocationy] = -1526.4036;
  602. CarInfo[idd][cLocationz] = 24.3208;
  603. CarInfo[idd][cAngle] = 235.1191;
  604. }
  605. else if(PlayerInfo[playerid][pprcarkey2] == 0)
  606. {
  607. PlayerInfo[playerid][pprcarkey2] = idd;
  608. Update(playerid,pprcarkey2x);
  609. CarInfo[idd][cLocationx] = 284.5032;
  610. CarInfo[idd][cLocationy] = -1526.4036;
  611. CarInfo[idd][cLocationz] = 24.3208;
  612. CarInfo[idd][cAngle] = 235.1191;
  613. }
  614. else if(PlayerInfo[playerid][pPPluscarkey] == 0)
  615. {
  616. PlayerInfo[playerid][pPPluscarkey] = idd;
  617. Update(playerid,pPPluscarkeyx);
  618. CarInfo[idd][cLocationx] = 284.5032;
  619. CarInfo[idd][cLocationy] = -1526.4036;
  620. CarInfo[idd][cLocationz] = 24.3208;
  621. CarInfo[idd][cAngle] = 235.1191;
  622. }
  623. else if(PlayerInfo[playerid][pPPluscarkey2] == 0)
  624. {
  625. PlayerInfo[playerid][pPPluscarkey2] = idd;
  626. Update(playerid,pPPluscarkey2x);
  627. CarInfo[idd][cLocationx] = 284.5032;
  628. CarInfo[idd][cLocationy] = -1526.4036;
  629. CarInfo[idd][cLocationz] = 24.3208;
  630. CarInfo[idd][cAngle] = 235.1191;
  631. }
  632. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 premium cars + 2 plus cars.");
  633. }
  634. }
  635. if(PlayerInfo[playerid][pPremiumAccount] > 0 && PlayerInfo[playerid][pPlusSlot1] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
  636. {
  637. if(PlayerInfo[playerid][pPcarkey] == 0)
  638. {
  639. PlayerInfo[playerid][pPcarkey] = idd;
  640. Update(playerid,pPcarkeyx);
  641. CarInfo[idd][cLocationx] = 284.5032;
  642. CarInfo[idd][cLocationy] = -1526.4036;
  643. CarInfo[idd][cLocationz] = 24.3208;
  644. CarInfo[idd][cAngle] = 235.1191;
  645. }
  646. else
  647. {
  648. if(PlayerInfo[playerid][pmotokey] == 0)
  649. {
  650. PlayerInfo[playerid][pmotokey] = idd;
  651. Update(playerid,pmotokeyx);
  652. CarInfo[idd][cLocationx] = 284.5032;
  653. CarInfo[idd][cLocationy] = -1526.4036;
  654. CarInfo[idd][cLocationz] = 24.3208;
  655. CarInfo[idd][cAngle] = 235.1191;
  656. }
  657. else if(PlayerInfo[playerid][pprcarkey] == 0)
  658. {
  659. PlayerInfo[playerid][pprcarkey] = idd;
  660. Update(playerid,pprcarkeyx);
  661. CarInfo[idd][cLocationx] = 284.5032;
  662. CarInfo[idd][cLocationy] = -1526.4036;
  663. CarInfo[idd][cLocationz] = 24.3208;
  664. CarInfo[idd][cAngle] = 235.1191;
  665. }
  666. else if(PlayerInfo[playerid][pprcarkey2] == 0)
  667. {
  668. PlayerInfo[playerid][pprcarkey2] = idd;
  669. Update(playerid,pprcarkey2x);
  670. CarInfo[idd][cLocationx] = 284.5032;
  671. CarInfo[idd][cLocationy] = -1526.4036;
  672. CarInfo[idd][cLocationz] = 24.3208;
  673. CarInfo[idd][cAngle] = 235.1191;
  674. }
  675. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 premium cars + 2 cars.");
  676. }
  677. }
  678. }
  679.  
  680. Stock[stockid][vStock]--;
  681. mysql_format(SQL, string, sizeof(string), "UPDATE stock SET Stock='%d' WHERE ID='%d'", Stock[stockid][vStock],stockid);
  682. mysql_tquery(SQL,string,"","");
  683.  
  684. GivePlayerCash(playerid,-value);
  685. Update(playerid,pCashx);
  686.  
  687. CarInfo[idd][cID] = idd;
  688. CarInfo[idd][cModel] = model;
  689.  
  690. CarInfo[idd][cColorOne] = 1;
  691. CarInfo[idd][cColorTwo] = 1;
  692. strmid(CarInfo[idd][cOwner], PlayerInfo[playerid][pNormalName], 0, 25, 255);
  693. strmid(CarInfo[idd][cDescription],namecar, 0, strlen(namecar), 255);
  694. CarInfo[idd][cValue] = value;
  695. strmid(CarInfo[idd][cLicense], "NewCar", 0, 6, 255);
  696. CarInfo[idd][cOwned] = 1;
  697. CarInfo[idd][cLock] = 0;
  698. CarInfo[idd][cTimed] = 0;
  699. CarInfo[idd][cInscarprice] = 100;
  700. CarInfo[idd][cInsurancecar] = 4;
  701. CarInfo[idd][cKM] = 0.0;
  702. CarInfo[idd][cHP] = 1000.0;
  703. CarInfo[idd][cDamage1] = 0;
  704. CarInfo[idd][cDamage2] = 0;
  705. CarInfo[idd][cDamage3] = 0;
  706. CarInfo[idd][cDamage4] = 0;
  707. CarInfo[idd][cGas] = 100;
  708. CarInfo[idd][cSell] = 1;
  709. CarInfo[idd][cPaintJ] = 6;
  710. CarInfo[idd][mod1] = 0;
  711. CarInfo[idd][mod2] = 0;
  712. CarInfo[idd][mod3] = 0;
  713. CarInfo[idd][mod4] = 0;
  714. CarInfo[idd][mod5] = 0;
  715. CarInfo[idd][mod6] = 0;
  716. CarInfo[idd][mod7] = 0;
  717. CarInfo[idd][mod8] = 0;
  718. CarInfo[idd][mod9] = 0;
  719. CarInfo[idd][mod10] = 0;
  720. CarInfo[idd][mod11] = 0;
  721. CarInfo[idd][mod12] = 0;
  722. CarInfo[idd][mod13] = 0;
  723. CarInfo[idd][mod14] = 0;
  724. CarInfo[idd][mod15] = 0;
  725. CarInfo[idd][mod16] = 0;
  726. CarInfo[idd][mod17] = 0;
  727. CarInfo[idd][cDays] = 0;
  728.  
  729. mysql_format(SQL, string, sizeof(string),"INSERT INTO cars (ID, Model) VALUES (%d, %d)", idd, CarInfo[idd][cModel]);
  730. mysql_tquery(SQL,string,"","");
  731.  
  732. vUpdate(idd, cModsx);
  733. vUpdate(idd, cPaintJx);
  734. vUpdate(idd, cSellx);
  735. vUpdate(idd, cLocationxx);
  736. vUpdate(idd, cLocationyx);
  737. vUpdate(idd, cLocationzx);
  738. vUpdate(idd, cAnglex);
  739. vUpdate(idd, cColorOnex);
  740. vUpdate(idd, cColorTwox);
  741. vUpdate(idd, cOwnerx);
  742. vUpdate(idd, cValuex);
  743. vUpdate(idd, cLicensex);
  744. vUpdate(idd, cDescriptionx);
  745. vUpdate(idd, cLockx);
  746. vUpdate(idd, cTimedx);
  747. vUpdate(idd, cInscarpricex);
  748. vUpdate(idd, cInsurancecarx);
  749. vUpdate(idd, cKMx);
  750. vUpdate(idd, cOwnedx);
  751. vUpdate(idd, cDaysx);
  752. vUpdate(idd, cHPx);
  753. vUpdate(idd, cDamage1x);
  754. vUpdate(idd, cDamage2x);
  755. vUpdate(idd, cDamage3x);
  756. vUpdate(idd, cDamage4x);
  757. vUpdate(idd, cGasx);
  758.  
  759. new car = CreateVehicle(CarInfo[idd][cModel],CarInfo[idd][cLocationx],CarInfo[idd][cLocationy],CarInfo[idd][cLocationz],CarInfo[idd][cAngle],1,1,500000);
  760. SetVehicleNumberPlate(car,CarInfo[idd][cLicense]);
  761.  
  762. new disp[184],stringsss[256],numele[30];
  763. format(disp,sizeof(disp),"You bought %s.Please take your car and park it elsewhere.",CarInfo[idd][cDescription]);
  764. SCM(playerid,COLOR_LIGHTBLUE,disp);
  765. GetPlayerName(playerid, numele, sizeof(numele));
  766. format(stringsss,sizeof(stringsss),"%s [user:%d] bought a %s [car:%d] for $%s.",numele,PlayerInfo[playerid][pSQLID],CarInfo[idd][cDescription],CarInfo[idd][cID],FormatNumber(value));
  767. ShowAdmins(COLOR_YELLOW,stringsss,1);
  768. new var100[256],y,m,d,h,mi,s,string2[256],string3[256];
  769. getdate(y,m,d);
  770. gettime(h,mi,s);
  771. format(string2,sizeof(string2),"[%02d-%02d-%d %02d:%02d:%02d] %s",d,m,y,h,mi,s,stringsss);
  772. mysql_real_escape_string(string2, string3);
  773. mysql_format(SQL, var100, sizeof(var100), "INSERT INTO playerlogs (`playerid`,`giverid`,`action`,`time`) VALUES ('%d','0','%s','%02d-%02d-%d %02d:%02d:%02d')", PlayerInfo[playerid][pSQLID],string3,d,m,y,h,mi,s);
  774. mysql_tquery(SQL,var100,"","");
  775.  
  776. OwnedVeh(car) = idd;
  777. if(idd == PlayerInfo[playerid][pPcarkey])
  778. {
  779. personalcar[0][playerid] = car;
  780. }
  781. if(idd == PlayerInfo[playerid][pmotokey])
  782. {
  783. personalcar[1][playerid] = car;
  784. }
  785. if(idd == PlayerInfo[playerid][pprcarkey])
  786. {
  787. personalcar[2][playerid] = car;
  788. }
  789. if(idd == PlayerInfo[playerid][pprcarkey2])
  790. {
  791. personalcar[3][playerid] = car;
  792. }
  793. if(idd == PlayerInfo[playerid][pPPluscarkey])
  794. {
  795. personalcar[4][playerid] = car;
  796. }
  797. if(idd == PlayerInfo[playerid][pPPluscarkey2])
  798. {
  799. personalcar[5][playerid] = car;
  800. }
  801.  
  802. masini++;
  803. SwitchKey[playerid] = 1;
  804. }
  805. return 1;
  806. }
  807. public VipCar(playerid,type,stockid)
  808. {
  809. new string[128],sendername[25],namecar[100];
  810. new idd = Findcar();
  811. new model = Stock[stockid][vModel];
  812. new value = Stock[stockid][vPrice];
  813. strmid(namecar,Stock[stockid][vName], 0, 100, 255);
  814. GetPlayerName(playerid,sendername,sizeof(sendername));
  815. BuyCar[playerid] = -1;
  816. if(idd != 0)
  817. {
  818. if(GetPlayerCash(playerid) < value) return SCM(playerid,COLOR_WHITE,"{FFB870}You do not have enough money.");
  819. if(type == 1)
  820. {
  821. if(PlayerInfo[playerid][pPPluscarkey2] == 0)
  822. {
  823. PlayerInfo[playerid][pPPluscarkey2] = idd;
  824. Update(playerid,pPPluscarkey2x);
  825. CarInfo[idd][cLocationx] = 284.5032;
  826. CarInfo[idd][cLocationy] = -1526.4036;
  827. CarInfo[idd][cLocationz] = 24.3208;
  828. CarInfo[idd][cAngle] = 235.1191;
  829. }
  830. else return SCM(playerid,COLOR_WHITE,"Nu ai niciun slot liber!");
  831. }
  832.  
  833. Stock[stockid][vStock]--;
  834. mysql_format(SQL, string, sizeof(string), "UPDATE stock SET Stock='%d' WHERE ID='%d'", Stock[stockid][vStock],stockid);
  835. mysql_tquery(SQL,string,"","");
  836.  
  837. GivePlayerCash(playerid,-value);
  838. Update(playerid,pCashx);
  839.  
  840. CarInfo[idd][cSell] = 1;
  841. CarInfo[idd][cID] = idd;
  842. CarInfo[idd][cModel] = model;
  843.  
  844. CarInfo[idd][cColorOne] = 1;
  845. CarInfo[idd][cColorTwo] = 1;
  846. strmid(CarInfo[idd][cOwner], PlayerInfo[playerid][pNormalName], 0, 25, 255);
  847. strmid(CarInfo[idd][cDescription],namecar, 0, strlen(namecar), 255);
  848. CarInfo[idd][cValue] = value;
  849. strmid(CarInfo[idd][cLicense], "NewCar", 0, 6, 255);
  850. CarInfo[idd][cOwned] = 1;
  851. CarInfo[idd][cLock] = 0;
  852. CarInfo[idd][cTimed] = 0;
  853. CarInfo[idd][cInscarprice] = 100;
  854. CarInfo[idd][cInsurancecar] = 4;
  855. CarInfo[idd][cKM] = 0.0;
  856. CarInfo[idd][cHP] = 1000.0;
  857. CarInfo[idd][cDamage1] = 0;
  858. CarInfo[idd][cDamage2] = 0;
  859. CarInfo[idd][cDamage3] = 0;
  860. CarInfo[idd][cDamage4] = 0;
  861. CarInfo[idd][cGas] = 100;
  862. CarInfo[idd][cPaintJ] = 6;
  863. CarInfo[idd][mod1] = 0;
  864. CarInfo[idd][mod2] = 0;
  865. CarInfo[idd][mod3] = 0;
  866. CarInfo[idd][mod4] = 0;
  867. CarInfo[idd][mod5] = 0;
  868. CarInfo[idd][mod6] = 0;
  869. CarInfo[idd][mod7] = 0;
  870. CarInfo[idd][mod8] = 0;
  871. CarInfo[idd][mod9] = 0;
  872. CarInfo[idd][mod10] = 0;
  873. CarInfo[idd][mod11] = 0;
  874. CarInfo[idd][mod12] = 0;
  875. CarInfo[idd][mod13] = 0;
  876. CarInfo[idd][mod14] = 0;
  877. CarInfo[idd][mod15] = 0;
  878. CarInfo[idd][mod16] = 0;
  879. CarInfo[idd][mod17] = 0;
  880. CarInfo[idd][cDays] = 0;
  881.  
  882. vUpdate(idd, cModsx);
  883. vUpdate(idd, cPaintJx);
  884. vUpdate(idd, cSellx);
  885. vUpdate(idd, cLocationxx);
  886. vUpdate(idd, cLocationyx);
  887. vUpdate(idd, cLocationzx);
  888. vUpdate(idd, cAnglex);
  889. vUpdate(idd, cModelx);
  890. vUpdate(idd, cColorOnex);
  891. vUpdate(idd, cColorTwox);
  892. vUpdate(idd, cOwnerx);
  893. vUpdate(idd, cValuex);
  894. vUpdate(idd, cLicensex);
  895. vUpdate(idd, cDescriptionx);
  896. vUpdate(idd, cLockx);
  897. vUpdate(idd, cTimedx);
  898. vUpdate(idd, cInscarpricex);
  899. vUpdate(idd, cInsurancecarx);
  900. vUpdate(idd, cKMx);
  901. vUpdate(idd, cOwnedx);
  902. vUpdate(idd, cDaysx);
  903. vUpdate(idd, cHPx);
  904. vUpdate(idd, cDamage1x);
  905. vUpdate(idd, cDamage2x);
  906. vUpdate(idd, cDamage3x);
  907. vUpdate(idd, cDamage4x);
  908. vUpdate(idd, cGasx);
  909.  
  910. new car = CreateVehicle(CarInfo[idd][cModel],CarInfo[idd][cLocationx],CarInfo[idd][cLocationy],CarInfo[idd][cLocationz],CarInfo[idd][cAngle],1,1,500000);
  911. SetVehicleNumberPlate(car,CarInfo[idd][cLicense]);
  912.  
  913. new disp[184],stringsss[256],numele[30];
  914. format(disp,sizeof(disp),"You bought %s.Please take your car and park it elsewhere.",CarInfo[idd][cDescription]);
  915. SCM(playerid,COLOR_LIGHTBLUE,disp);
  916. GetPlayerName(playerid, numele, sizeof(numele));
  917. format(stringsss,sizeof(stringsss),"%s [user:%d] bought a %s [car:%d] for $%s.",numele,PlayerInfo[playerid][pSQLID],CarInfo[idd][cDescription],CarInfo[idd][cID],FormatNumber(value));
  918. ShowAdmins(COLOR_YELLOW,stringsss,1);
  919. new var100[256],y,m,d,h,mi,s,string2[256],string3[256];
  920. getdate(y,m,d);
  921. gettime(h,mi,s);
  922. format(string2,sizeof(string2),"[%02d-%02d-%d %02d:%02d:%02d] %s",d,m,y,h,mi,s,stringsss);
  923. mysql_real_escape_string(string2, string3);
  924. mysql_format(SQL, var100, sizeof(var100), "INSERT INTO playerlogs (`playerid`,`giverid`,`action`,`time`) VALUES ('%d','0','%s','%02d-%02d-%d %02d:%02d:%02d')", PlayerInfo[playerid][pSQLID],string3,d,m,y,h,mi,s);
  925. mysql_tquery(SQL,var100,"","");
  926.  
  927. OwnedVeh(car) = idd;
  928. if(idd == PlayerInfo[playerid][pPcarkey])
  929. {
  930. personalcar[0][playerid] = car;
  931. }
  932. if(idd == PlayerInfo[playerid][pmotokey])
  933. {
  934. personalcar[1][playerid] = car;
  935. }
  936. if(idd == PlayerInfo[playerid][pprcarkey])
  937. {
  938. personalcar[2][playerid] = car;
  939. }
  940. if(idd == PlayerInfo[playerid][pprcarkey2])
  941. {
  942. personalcar[3][playerid] = car;
  943. }
  944. if(idd == PlayerInfo[playerid][pPPluscarkey])
  945. {
  946. personalcar[4][playerid] = car;
  947. }
  948. if(idd == PlayerInfo[playerid][pPPluscarkey2])
  949. {
  950. personalcar[5][playerid] = car;
  951. }
  952. masini++;
  953. SwitchKey[playerid] = 1;
  954. }
  955. if(idd == 0)
  956. {
  957. if(GetPlayerCash(playerid) < value) return SCM(playerid,COLOR_WHITE,"{FFB870}You do not have enough money.");
  958.  
  959. new Cache: sar = mysql_query(SQL,"SELECT * FROM `cars`");
  960. idd = cache_num_rows()+1;
  961. cache_delete(sar);
  962.  
  963. if(type == 1)
  964. {
  965. if(PlayerInfo[playerid][pPremiumAccount] == 0 && PlayerInfo[playerid][pPlusSlot1] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
  966. {
  967. if(PlayerInfo[playerid][pPcarkey] == 0)
  968. {
  969. PlayerInfo[playerid][pPcarkey] = idd;
  970. Update(playerid,pPcarkeyx);
  971. CarInfo[idd][cLocationx] = 284.5032;
  972. CarInfo[idd][cLocationy] = -1526.4036;
  973. CarInfo[idd][cLocationz] = 24.3208;
  974. CarInfo[idd][cAngle] = 235.1191;
  975. }
  976. else
  977. {
  978. if(PlayerInfo[playerid][pmotokey] == 0)
  979. {
  980. PlayerInfo[playerid][pmotokey] = idd;
  981. Update(playerid,pmotokeyx);
  982. CarInfo[idd][cLocationx] = 284.5032;
  983. CarInfo[idd][cLocationy] = -1526.4036;
  984. CarInfo[idd][cLocationz] = 24.3208;
  985. CarInfo[idd][cAngle] = 235.1191;
  986. }
  987. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars.");
  988. }
  989. }
  990. if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPremiumAccount] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
  991. {
  992. if(PlayerInfo[playerid][pPcarkey] == 0)
  993. {
  994. PlayerInfo[playerid][pPcarkey] = idd;
  995. Update(playerid,pPcarkeyx);
  996. CarInfo[idd][cLocationx] = 284.5032;
  997. CarInfo[idd][cLocationy] = -1526.4036;
  998. CarInfo[idd][cLocationz] = 24.3208;
  999. CarInfo[idd][cAngle] = 235.1191;
  1000. }
  1001. else
  1002. {
  1003. if(PlayerInfo[playerid][pmotokey] == 0)
  1004. {
  1005. PlayerInfo[playerid][pmotokey] = idd;
  1006. Update(playerid,pmotokeyx);
  1007. CarInfo[idd][cLocationx] = 284.5032;
  1008. CarInfo[idd][cLocationy] = -1526.4036;
  1009. CarInfo[idd][cLocationz] = 24.3208;
  1010. CarInfo[idd][cAngle] = 235.1191;
  1011. }
  1012. else if(PlayerInfo[playerid][pPPluscarkey] == 0)
  1013. {
  1014. PlayerInfo[playerid][pPPluscarkey] = idd;
  1015. Update(playerid,pPPluscarkeyx);
  1016. CarInfo[idd][cLocationx] = 284.5032;
  1017. CarInfo[idd][cLocationy] = -1526.4036;
  1018. CarInfo[idd][cLocationz] = 24.3208;
  1019. CarInfo[idd][cAngle] = 235.1191;
  1020. }
  1021. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 1 plus car.");
  1022. }
  1023. }
  1024. if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 1 && PlayerInfo[playerid][pPremiumAccount] == 0)
  1025. {
  1026. if(PlayerInfo[playerid][pPcarkey] == 0)
  1027. {
  1028. PlayerInfo[playerid][pPcarkey] = idd;
  1029. Update(playerid,pPcarkeyx);
  1030. CarInfo[idd][cLocationx] = 284.5032;
  1031. CarInfo[idd][cLocationy] = -1526.4036;
  1032. CarInfo[idd][cLocationz] = 24.3208;
  1033. CarInfo[idd][cAngle] = 235.1191;
  1034. }
  1035. else
  1036. {
  1037. if(PlayerInfo[playerid][pmotokey] == 0)
  1038. {
  1039. PlayerInfo[playerid][pmotokey] = idd;
  1040. Update(playerid,pmotokeyx);
  1041. CarInfo[idd][cLocationx] = 284.5032;
  1042. CarInfo[idd][cLocationy] = -1526.4036;
  1043. CarInfo[idd][cLocationz] = 24.3208;
  1044. CarInfo[idd][cAngle] = 235.1191;
  1045. }
  1046. else if(PlayerInfo[playerid][pPPluscarkey] == 0)
  1047. {
  1048. PlayerInfo[playerid][pPPluscarkey] = idd;
  1049. Update(playerid,pPPluscarkeyx);
  1050. CarInfo[idd][cLocationx] = 284.5032;
  1051. CarInfo[idd][cLocationy] = -1526.4036;
  1052. CarInfo[idd][cLocationz] = 24.3208;
  1053. CarInfo[idd][cAngle] = 235.1191;
  1054. }
  1055. else if(PlayerInfo[playerid][pPPluscarkey2] == 0)
  1056. {
  1057. PlayerInfo[playerid][pPPluscarkey2] = idd;
  1058. Update(playerid,pPPluscarkey2x);
  1059. CarInfo[idd][cLocationx] = 284.5032;
  1060. CarInfo[idd][cLocationy] = -1526.4036;
  1061. CarInfo[idd][cLocationz] = 24.3208;
  1062. CarInfo[idd][cAngle] = 235.1191;
  1063. }
  1064. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 plus cars.");
  1065. }
  1066. }
  1067. if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 0 && PlayerInfo[playerid][pPremiumAccount] > 0)
  1068. {
  1069. if(PlayerInfo[playerid][pPcarkey] == 0)
  1070. {
  1071. PlayerInfo[playerid][pPcarkey] = idd;
  1072. Update(playerid,pPcarkeyx);
  1073. CarInfo[idd][cLocationx] = 284.5032;
  1074. CarInfo[idd][cLocationy] = -1526.4036;
  1075. CarInfo[idd][cLocationz] = 24.3208;
  1076. CarInfo[idd][cAngle] = 235.1191;
  1077. }
  1078. else
  1079. {
  1080. if(PlayerInfo[playerid][pmotokey] == 0)
  1081. {
  1082. PlayerInfo[playerid][pmotokey] = idd;
  1083. Update(playerid,pmotokeyx);
  1084. CarInfo[idd][cLocationx] = 284.5032;
  1085. CarInfo[idd][cLocationy] = -1526.4036;
  1086. CarInfo[idd][cLocationz] = 24.3208;
  1087. CarInfo[idd][cAngle] = 235.1191;
  1088. }
  1089. else if(PlayerInfo[playerid][pprcarkey] == 0)
  1090. {
  1091. PlayerInfo[playerid][pprcarkey] = idd;
  1092. Update(playerid,pprcarkeyx);
  1093. CarInfo[idd][cLocationx] = 284.5032;
  1094. CarInfo[idd][cLocationy] = -1526.4036;
  1095. CarInfo[idd][cLocationz] = 24.3208;
  1096. CarInfo[idd][cAngle] = 235.1191;
  1097. }
  1098. else if(PlayerInfo[playerid][pprcarkey2] == 0)
  1099. {
  1100. PlayerInfo[playerid][pprcarkey2] = idd;
  1101. Update(playerid,pprcarkey2x);
  1102. CarInfo[idd][cLocationx] = 284.5032;
  1103. CarInfo[idd][cLocationy] = -1526.4036;
  1104. CarInfo[idd][cLocationz] = 24.3208;
  1105. CarInfo[idd][cAngle] = 235.1191;
  1106. }
  1107. else if(PlayerInfo[playerid][pPPluscarkey] == 0)
  1108. {
  1109. PlayerInfo[playerid][pPPluscarkey] = idd;
  1110. Update(playerid,pPPluscarkeyx);
  1111. CarInfo[idd][cLocationx] = 284.5032;
  1112. CarInfo[idd][cLocationy] = -1526.4036;
  1113. CarInfo[idd][cLocationz] = 24.3208;
  1114. CarInfo[idd][cAngle] = 235.1191;
  1115. }
  1116. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 premium cars + 1 plus car.");
  1117. }
  1118. }
  1119. if(PlayerInfo[playerid][pPlusSlot1] == 1 && PlayerInfo[playerid][pPlusSlot2] == 1 && PlayerInfo[playerid][pPremiumAccount] > 0)
  1120. {
  1121. if(PlayerInfo[playerid][pPcarkey] == 0)
  1122. {
  1123. PlayerInfo[playerid][pPcarkey] = idd;
  1124. Update(playerid,pPcarkeyx);
  1125. CarInfo[idd][cLocationx] = 284.5032;
  1126. CarInfo[idd][cLocationy] = -1526.4036;
  1127. CarInfo[idd][cLocationz] = 24.3208;
  1128. CarInfo[idd][cAngle] = 235.1191;
  1129. }
  1130. else
  1131. {
  1132. if(PlayerInfo[playerid][pmotokey] == 0)
  1133. {
  1134. PlayerInfo[playerid][pmotokey] = idd;
  1135. Update(playerid,pmotokeyx);
  1136. CarInfo[idd][cLocationx] = 284.5032;
  1137. CarInfo[idd][cLocationy] = -1526.4036;
  1138. CarInfo[idd][cLocationz] = 24.3208;
  1139. CarInfo[idd][cAngle] = 235.1191;
  1140. }
  1141. else if(PlayerInfo[playerid][pprcarkey] == 0)
  1142. {
  1143. PlayerInfo[playerid][pprcarkey] = idd;
  1144. Update(playerid,pprcarkeyx);
  1145. CarInfo[idd][cLocationx] = 284.5032;
  1146. CarInfo[idd][cLocationy] = -1526.4036;
  1147. CarInfo[idd][cLocationz] = 24.3208;
  1148. CarInfo[idd][cAngle] = 235.1191;
  1149. }
  1150. else if(PlayerInfo[playerid][pprcarkey2] == 0)
  1151. {
  1152. PlayerInfo[playerid][pprcarkey2] = idd;
  1153. Update(playerid,pprcarkey2x);
  1154. CarInfo[idd][cLocationx] = 284.5032;
  1155. CarInfo[idd][cLocationy] = -1526.4036;
  1156. CarInfo[idd][cLocationz] = 24.3208;
  1157. CarInfo[idd][cAngle] = 235.1191;
  1158. }
  1159. else if(PlayerInfo[playerid][pPPluscarkey] == 0)
  1160. {
  1161. PlayerInfo[playerid][pPPluscarkey] = idd;
  1162. Update(playerid,pPPluscarkeyx);
  1163. CarInfo[idd][cLocationx] = 284.5032;
  1164. CarInfo[idd][cLocationy] = -1526.4036;
  1165. CarInfo[idd][cLocationz] = 24.3208;
  1166. CarInfo[idd][cAngle] = 235.1191;
  1167. }
  1168. else if(PlayerInfo[playerid][pPPluscarkey2] == 0)
  1169. {
  1170. PlayerInfo[playerid][pPPluscarkey2] = idd;
  1171. Update(playerid,pPPluscarkey2x);
  1172. CarInfo[idd][cLocationx] = 284.5032;
  1173. CarInfo[idd][cLocationy] = -1526.4036;
  1174. CarInfo[idd][cLocationz] = 24.3208;
  1175. CarInfo[idd][cAngle] = 235.1191;
  1176. }
  1177. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 cars + 2 premium cars + 2 plus cars.");
  1178. }
  1179. }
  1180. if(PlayerInfo[playerid][pPremiumAccount] > 0 && PlayerInfo[playerid][pPlusSlot1] == 0 && PlayerInfo[playerid][pPlusSlot2] == 0)
  1181. {
  1182. if(PlayerInfo[playerid][pPcarkey] == 0)
  1183. {
  1184. PlayerInfo[playerid][pPcarkey] = idd;
  1185. Update(playerid,pPcarkeyx);
  1186. CarInfo[idd][cLocationx] = 284.5032;
  1187. CarInfo[idd][cLocationy] = -1526.4036;
  1188. CarInfo[idd][cLocationz] = 24.3208;
  1189. CarInfo[idd][cAngle] = 235.1191;
  1190. }
  1191. else
  1192. {
  1193. if(PlayerInfo[playerid][pmotokey] == 0)
  1194. {
  1195. PlayerInfo[playerid][pmotokey] = idd;
  1196. Update(playerid,pmotokeyx);
  1197. CarInfo[idd][cLocationx] = 284.5032;
  1198. CarInfo[idd][cLocationy] = -1526.4036;
  1199. CarInfo[idd][cLocationz] = 24.3208;
  1200. CarInfo[idd][cAngle] = 235.1191;
  1201. }
  1202. else if(PlayerInfo[playerid][pprcarkey] == 0)
  1203. {
  1204. PlayerInfo[playerid][pprcarkey] = idd;
  1205. Update(playerid,pprcarkeyx);
  1206. CarInfo[idd][cLocationx] = 284.5032;
  1207. CarInfo[idd][cLocationy] = -1526.4036;
  1208. CarInfo[idd][cLocationz] = 24.3208;
  1209. CarInfo[idd][cAngle] = 235.1191;
  1210. }
  1211. else if(PlayerInfo[playerid][pprcarkey2] == 0)
  1212. {
  1213. PlayerInfo[playerid][pprcarkey2] = idd;
  1214. Update(playerid,pprcarkey2x);
  1215. CarInfo[idd][cLocationx] = 284.5032;
  1216. CarInfo[idd][cLocationy] = -1526.4036;
  1217. CarInfo[idd][cLocationz] = 24.3208;
  1218. CarInfo[idd][cAngle] = 235.1191;
  1219. }
  1220. else return SCM(playerid,COLOR_WHITE,"{FFB870}Already own 2 premium cars + 2 cars.");
  1221. }
  1222. }
  1223. }
  1224.  
  1225. Stock[stockid][vStock]--;
  1226. mysql_format(SQL, string, sizeof(string), "UPDATE stock SET Stock='%d' WHERE ID='%d'", Stock[stockid][vStock],stockid);
  1227. mysql_tquery(SQL,string,"","");
  1228.  
  1229. GivePlayerCash(playerid,-value);
  1230. Update(playerid,pCashx);
  1231.  
  1232. CarInfo[idd][cID] = idd;
  1233. CarInfo[idd][cModel] = model;
  1234.  
  1235. CarInfo[idd][cColorOne] = 1;
  1236. CarInfo[idd][cColorTwo] = 1;
  1237. strmid(CarInfo[idd][cOwner], PlayerInfo[playerid][pNormalName], 0, 25, 255);
  1238. strmid(CarInfo[idd][cDescription],namecar, 0, strlen(namecar), 255);
  1239. CarInfo[idd][cValue] = value;
  1240. strmid(CarInfo[idd][cLicense], "NewCar", 0, 6, 255);
  1241. CarInfo[idd][cOwned] = 1;
  1242. CarInfo[idd][cLock] = 0;
  1243. CarInfo[idd][cTimed] = 0;
  1244. CarInfo[idd][cInscarprice] = 100;
  1245. CarInfo[idd][cInsurancecar] = 4;
  1246. CarInfo[idd][cKM] = 0.0;
  1247. CarInfo[idd][cHP] = 1000.0;
  1248. CarInfo[idd][cDamage1] = 0;
  1249. CarInfo[idd][cDamage2] = 0;
  1250. CarInfo[idd][cDamage3] = 0;
  1251. CarInfo[idd][cDamage4] = 0;
  1252. CarInfo[idd][cGas] = 100;
  1253. CarInfo[idd][cSell] = 1;
  1254. CarInfo[idd][cPaintJ] = 6;
  1255. CarInfo[idd][mod1] = 0;
  1256. CarInfo[idd][mod2] = 0;
  1257. CarInfo[idd][mod3] = 0;
  1258. CarInfo[idd][mod4] = 0;
  1259. CarInfo[idd][mod5] = 0;
  1260. CarInfo[idd][mod6] = 0;
  1261. CarInfo[idd][mod7] = 0;
  1262. CarInfo[idd][mod8] = 0;
  1263. CarInfo[idd][mod9] = 0;
  1264. CarInfo[idd][mod10] = 0;
  1265. CarInfo[idd][mod11] = 0;
  1266. CarInfo[idd][mod12] = 0;
  1267. CarInfo[idd][mod13] = 0;
  1268. CarInfo[idd][mod14] = 0;
  1269. CarInfo[idd][mod15] = 0;
  1270. CarInfo[idd][mod16] = 0;
  1271. CarInfo[idd][mod17] = 0;
  1272. CarInfo[idd][cDays] = 0;
  1273.  
  1274. mysql_format(SQL, string, sizeof(string),"INSERT INTO cars (ID, Model) VALUES (%d, %d)", idd, CarInfo[idd][cModel]);
  1275. mysql_tquery(SQL,string,"","");
  1276.  
  1277. vUpdate(idd, cModsx);
  1278. vUpdate(idd, cPaintJx);
  1279. vUpdate(idd, cSellx);
  1280. vUpdate(idd, cLocationxx);
  1281. vUpdate(idd, cLocationyx);
  1282. vUpdate(idd, cLocationzx);
  1283. vUpdate(idd, cAnglex);
  1284. vUpdate(idd, cColorOnex);
  1285. vUpdate(idd, cColorTwox);
  1286. vUpdate(idd, cOwnerx);
  1287. vUpdate(idd, cValuex);
  1288. vUpdate(idd, cLicensex);
  1289. vUpdate(idd, cDescriptionx);
  1290. vUpdate(idd, cLockx);
  1291. vUpdate(idd, cTimedx);
  1292. vUpdate(idd, cInscarpricex);
  1293. vUpdate(idd, cInsurancecarx);
  1294. vUpdate(idd, cKMx);
  1295. vUpdate(idd, cOwnedx);
  1296. vUpdate(idd, cDaysx);
  1297. vUpdate(idd, cHPx);
  1298. vUpdate(idd, cDamage1x);
  1299. vUpdate(idd, cDamage2x);
  1300. vUpdate(idd, cDamage3x);
  1301. vUpdate(idd, cDamage4x);
  1302. vUpdate(idd, cGasx);
  1303.  
  1304. new car = CreateVehicle(CarInfo[idd][cModel],CarInfo[idd][cLocationx],CarInfo[idd][cLocationy],CarInfo[idd][cLocationz],CarInfo[idd][cAngle],1,1,500000);
  1305. SetVehicleNumberPlate(car,CarInfo[idd][cLicense]);
  1306.  
  1307. new disp[184],stringsss[256],numele[30];
  1308. format(disp,sizeof(disp),"You bought %s.Please take your car and park it elsewhere.",CarInfo[idd][cDescription]);
  1309. SCM(playerid,COLOR_LIGHTBLUE,disp);
  1310. GetPlayerName(playerid, numele, sizeof(numele));
  1311. format(stringsss,sizeof(stringsss),"%s [user:%d] bought a %s [car:%d] for $%s.",numele,PlayerInfo[playerid][pSQLID],CarInfo[idd][cDescription],CarInfo[idd][cID],FormatNumber(value));
  1312. ShowAdmins(COLOR_YELLOW,stringsss,1);
  1313. new var100[256],y,m,d,h,mi,s,string2[256],string3[256];
  1314. getdate(y,m,d);
  1315. gettime(h,mi,s);
  1316. format(string2,sizeof(string2),"[%02d-%02d-%d %02d:%02d:%02d] %s",d,m,y,h,mi,s,stringsss);
  1317. mysql_real_escape_string(string2, string3);
  1318. mysql_format(SQL, var100, sizeof(var100), "INSERT INTO playerlogs (`playerid`,`giverid`,`action`,`time`) VALUES ('%d','0','%s','%02d-%02d-%d %02d:%02d:%02d')", PlayerInfo[playerid][pSQLID],string3,d,m,y,h,mi,s);
  1319. mysql_tquery(SQL,var100,"","");
  1320.  
  1321. OwnedVeh(car) = idd;
  1322. if(idd == PlayerInfo[playerid][pPcarkey])
  1323. {
  1324. personalcar[0][playerid] = car;
  1325. }
  1326. if(idd == PlayerInfo[playerid][pmotokey])
  1327. {
  1328. personalcar[1][playerid] = car;
  1329. }
  1330. if(idd == PlayerInfo[playerid][pprcarkey])
  1331. {
  1332. personalcar[2][playerid] = car;
  1333. }
  1334. if(idd == PlayerInfo[playerid][pprcarkey2])
  1335. {
  1336. personalcar[3][playerid] = car;
  1337. }
  1338. if(idd == PlayerInfo[playerid][pPPluscarkey])
  1339. {
  1340. personalcar[4][playerid] = car;
  1341. }
  1342. if(idd == PlayerInfo[playerid][pPPluscarkey2])
  1343. {
  1344. personalcar[5][playerid] = car;
  1345. }
  1346.  
  1347. masini++;
  1348. SwitchKey[playerid] = 1;
  1349. }
  1350. return 1;
  1351. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement