Guest User

Untitled

a guest
Feb 19th, 2011
912
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.62 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. /* TUNING SAVER BY BLACKFOX */
  4. forward TuneThisCar(vehicleid);
  5. forward LoadModsForAll(vehicleid);
  6. forward SaveModsForAll(vehicleid);
  7. new spoiler[20][0] = {
  8. {1000},
  9. {1001},
  10. {1002},
  11. {1003},
  12. {1014},
  13. {1015},
  14. {1016},
  15. {1023},
  16. {1058},
  17. {1060},
  18. {1049},
  19. {1050},
  20. {1138},
  21. {1139},
  22. {1146},
  23. {1147},
  24. {1158},
  25. {1162},
  26. {1163},
  27. {1164}
  28. };
  29.  
  30. new nitro[3][0] = {
  31. {1008},
  32. {1009},
  33. {1010}
  34. };
  35.  
  36. new fbumper[23][0] = {
  37. {1117},
  38. {1152},
  39. {1153},
  40. {1155},
  41. {1157},
  42. {1160},
  43. {1165},
  44. {1167},
  45. {1169},
  46. {1170},
  47. {1171},
  48. {1172},
  49. {1173},
  50. {1174},
  51. {1175},
  52. {1179},
  53. {1181},
  54. {1182},
  55. {1185},
  56. {1188},
  57. {1189},
  58. {1192},
  59. {1193}
  60. };
  61.  
  62. new rbumper[22][0] = {
  63. {1140},
  64. {1141},
  65. {1148},
  66. {1149},
  67. {1150},
  68. {1151},
  69. {1154},
  70. {1156},
  71. {1159},
  72. {1161},
  73. {1166},
  74. {1168},
  75. {1176},
  76. {1177},
  77. {1178},
  78. {1180},
  79. {1183},
  80. {1184},
  81. {1186},
  82. {1187},
  83. {1190},
  84. {1191}
  85. };
  86.  
  87. new exhaust[28][0] = {
  88. {1018},
  89. {1019},
  90. {1020},
  91. {1021},
  92. {1022},
  93. {1028},
  94. {1029},
  95. {1037},
  96. {1043},
  97. {1044},
  98. {1045},
  99. {1046},
  100. {1059},
  101. {1064},
  102. {1065},
  103. {1066},
  104. {1089},
  105. {1092},
  106. {1104},
  107. {1105},
  108. {1113},
  109. {1114},
  110. {1126},
  111. {1127},
  112. {1129},
  113. {1132},
  114. {1135},
  115. {1136}
  116. };
  117.  
  118. new bventr[2][0] = {
  119. {1042},
  120. {1044}
  121. };
  122.  
  123. new bventl[2][0] = {
  124. {1043},
  125. {1045}
  126. };
  127.  
  128. new bscoop[4][0] = {
  129. {1004},
  130. {1005},
  131. {1011},
  132. {1012}
  133. };
  134.  
  135. new rscoop[13][0] = {
  136. {1006},
  137. {1032},
  138. {1033},
  139. {1035},
  140. {1038},
  141. {1053},
  142. {1054},
  143. {1055},
  144. {1061},
  145. {1067},
  146. {1068},
  147. {1088},
  148. {1091}
  149. };
  150.  
  151. new lskirt[21][0] = {
  152. {1007},
  153. {1026},
  154. {1031},
  155. {1036},
  156. {1039},
  157. {1042},
  158. {1047},
  159. {1048},
  160. {1056},
  161. {1057},
  162. {1069},
  163. {1070},
  164. {1090},
  165. {1093},
  166. {1106},
  167. {1108},
  168. {1118},
  169. {1119},
  170. {1133},
  171. {1122},
  172. {1134}
  173. };
  174.  
  175. new rskirt[21][0] = {
  176. {1017},
  177. {1027},
  178. {1030},
  179. {1040},
  180. {1041},
  181. {1051},
  182. {1052},
  183. {1062},
  184. {1063},
  185. {1071},
  186. {1072},
  187. {1094},
  188. {1095},
  189. {1099},
  190. {1101},
  191. {1102},
  192. {1107},
  193. {1120},
  194. {1121},
  195. {1124},
  196. {1137}
  197. };
  198.  
  199. new hydraulics[1][0] = {
  200. {1087}
  201. };
  202.  
  203. new base[1][0] = {
  204. {1086}
  205. };
  206.  
  207. new rbbars[2][0] = {
  208. {1109},
  209. {1110}
  210. };
  211.  
  212. new fbbars[2][0] = {
  213. {1115},
  214. {1116}
  215. };
  216.  
  217. new wheels[17][0] = {
  218. {1025},
  219. {1073},
  220. {1074},
  221. {1075},
  222. {1076},
  223. {1077},
  224. {1078},
  225. {1079},
  226. {1080},
  227. {1081},
  228. {1082},
  229. {1083},
  230. {1084},
  231. {1085},
  232. {1096},
  233. {1097},
  234. {1098}
  235. };
  236.  
  237. new lights[2][0] = {
  238. {1013},
  239. {1024}
  240. };
  241. //
  242. enum tInfo
  243. {
  244. mod1,
  245. mod2,
  246. mod3,
  247. mod4,
  248. mod5,
  249. mod6,
  250. mod7,
  251. mod8,
  252. mod9,
  253. mod10,
  254. mod11,
  255. mod12,
  256. mod13,
  257. mod14,
  258. mod15,
  259. mod16,
  260. mod17,
  261. paintjob,
  262. colorA,
  263. colorB,
  264. }
  265. new TuneCar[MAX_VEHICLES][tInfo];
  266.  
  267. #define FILTERSCRIPT
  268.  
  269. #if defined FILTERSCRIPT
  270.  
  271. public OnFilterScriptInit()
  272. {
  273. print("\n--------------------------------------");
  274. print(" BlackFoX's Tuning SaVe");
  275. print("--------------------------------------\n");
  276. return 1;
  277. }
  278.  
  279. public OnFilterScriptExit()
  280. {
  281. return 1;
  282. }
  283.  
  284. #else
  285.  
  286. main()
  287. {
  288. }
  289.  
  290. #endif
  291.  
  292. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  293. {
  294. LoadModsForAll(vehicleid);
  295. TuneThisCar(vehicleid);
  296. return 1;
  297. }
  298.  
  299. public OnPlayerExitVehicle(playerid, vehicleid)
  300. {
  301. SaveModsForAll(vehicleid);
  302. return 1;
  303. }
  304.  
  305. public OnPlayerStateChange(playerid, newstate, oldstate)
  306. {
  307. return 1;
  308. }
  309.  
  310. public OnPlayerEnterCheckpoint(playerid)
  311. {
  312. return 1;
  313. }
  314.  
  315. public OnPlayerLeaveCheckpoint(playerid)
  316. {
  317. return 1;
  318. }
  319.  
  320. public OnPlayerEnterRaceCheckpoint(playerid)
  321. {
  322. return 1;
  323. }
  324.  
  325. public OnPlayerLeaveRaceCheckpoint(playerid)
  326. {
  327. return 1;
  328. }
  329.  
  330. public OnRconCommand(cmd[])
  331. {
  332. return 1;
  333. }
  334.  
  335. public OnObjectMoved(objectid)
  336. {
  337. return 1;
  338. }
  339.  
  340. public OnPlayerObjectMoved(playerid, objectid)
  341. {
  342. return 1;
  343. }
  344.  
  345. public OnPlayerPickUpPickup(playerid, pickupid)
  346. {
  347. return 1;
  348. }
  349.  
  350. public OnPlayerSelectedMenuRow(playerid, row)
  351. {
  352. return 1;
  353. }
  354.  
  355. public OnPlayerExitedMenu(playerid)
  356. {
  357. return 1;
  358. }
  359. //
  360. public TuneThisCar(vehicleid)
  361. {
  362. if(TuneCar[vehicleid][mod1]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod1]); }
  363. if(TuneCar[vehicleid][mod2]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod2]); }
  364. if(TuneCar[vehicleid][mod3]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod3]); }
  365. if(TuneCar[vehicleid][mod4]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod4]); }
  366. if(TuneCar[vehicleid][mod5]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod5]); }
  367. if(TuneCar[vehicleid][mod6]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod6]); }
  368. if(TuneCar[vehicleid][mod7]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod7]); }
  369. if(TuneCar[vehicleid][mod8]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod8]); }
  370. if(TuneCar[vehicleid][mod9]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod9]); }
  371. if(TuneCar[vehicleid][mod10]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod10]); }
  372. if(TuneCar[vehicleid][mod11]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod11]); }
  373. if(TuneCar[vehicleid][mod12]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod12]); }
  374. if(TuneCar[vehicleid][mod13]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod13]); }
  375. if(TuneCar[vehicleid][mod14]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod14]); }
  376. if(TuneCar[vehicleid][mod15]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod15]); }
  377. if(TuneCar[vehicleid][mod16]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod16]); }
  378. if(TuneCar[vehicleid][mod17]!=0) { AddVehicleComponent(vehicleid,TuneCar[vehicleid][mod17]); }
  379. if(TuneCar[vehicleid][colorA]!=0 || TuneCar[vehicleid][colorB]!=0)
  380. {
  381. ChangeVehicleColor(vehicleid,TuneCar[vehicleid][colorA],TuneCar[vehicleid][colorB]);
  382. }
  383. if(TuneCar[vehicleid][paintjob]!=0) { ChangeVehiclePaintjob(vehicleid,TuneCar[vehicleid][paintjob]); }
  384. return 1;
  385. }
  386. InitComponents(componentid)
  387. {
  388. new i;
  389. for(i=0; i<20; i++)
  390. {
  391. if(spoiler[i][0]==componentid) { return 1; }
  392. }
  393. for(i=0; i<3; i++)
  394. {
  395. if(nitro[i][0]==componentid) { return 2; }
  396. }
  397. for(i=0; i<23; i++)
  398. {
  399. if(fbumper[i][0]==componentid) { return 3; }
  400. }
  401. for(i=0; i<22; i++)
  402. {
  403. if(rbumper[i][0]==componentid) { return 4; }
  404. }
  405. for(i=0; i<28; i++)
  406. {
  407. if(exhaust[i][0]==componentid) { return 5; }
  408. }
  409. for(i=0; i<2; i++)
  410. {
  411. if(bventr[i][0]==componentid) { return 6; }
  412. }
  413. for(i=0; i<2; i++)
  414. {
  415. if(bventl[i][0]==componentid) { return 7; }
  416. }
  417. for(i=0; i<4; i++)
  418. {
  419. if(bscoop[i][0]==componentid) { return 8; }
  420. }
  421. for(i=0; i<13; i++)
  422. {
  423. if(rscoop[i][0]==componentid) { return 9; }
  424. }
  425. for(i=0; i<21; i++)
  426. {
  427. if(lskirt[i][0]==componentid) { return 10; }
  428. }
  429. for(i=0; i<21; i++)
  430. {
  431. if(rskirt[i][0]==componentid) { return 11; }
  432. }
  433. if(hydraulics[0][0]==componentid) { return 12; }
  434. if(base[0][0]==componentid) { return 13; }
  435. for(i=0; i<2; i++)
  436. {
  437. if(rbbars[i][0]==componentid) { return 14; }
  438. }
  439. for(i=0; i<2; i++)
  440. {
  441. if(fbbars[i][0]==componentid) { return 15; }
  442. }
  443. for(i=0; i<17; i++)
  444. {
  445. if(wheels[i][0]==componentid) { return 16; }
  446. }
  447. for(i=0; i<2; i++)
  448. {
  449. if(lights[i][0]==componentid) { return 17; }
  450. }
  451. return 0;
  452. }
  453. //
  454. public OnVehicleMod(playerid,vehicleid,componentid)
  455. {
  456. new Varz=InitComponents(componentid);
  457. switch (Varz)
  458. {
  459. case 1: { TuneCar[vehicleid][mod1]=componentid; }
  460. case 2: { TuneCar[vehicleid][mod2]=componentid; }
  461. case 3: { TuneCar[vehicleid][mod3]=componentid; }
  462. case 4: { TuneCar[vehicleid][mod4]=componentid; }
  463. case 5: { TuneCar[vehicleid][mod5]=componentid; }
  464. case 6: { TuneCar[vehicleid][mod6]=componentid; }
  465. case 7: { TuneCar[vehicleid][mod7]=componentid; }
  466. case 8: { TuneCar[vehicleid][mod8]=componentid; }
  467. case 9: { TuneCar[vehicleid][mod9]=componentid; }
  468. case 10: { TuneCar[vehicleid][mod10]=componentid; }
  469. case 11: { TuneCar[vehicleid][mod11]=componentid; }
  470. case 12: { TuneCar[vehicleid][mod12]=componentid; }
  471. case 13: { TuneCar[vehicleid][mod13]=componentid; }
  472. case 14: { TuneCar[vehicleid][mod14]=componentid; }
  473. case 15: { TuneCar[vehicleid][mod15]=componentid; }
  474. case 16: { TuneCar[vehicleid][mod16]=componentid; }
  475. case 17: { TuneCar[vehicleid][mod17]=componentid; }
  476. }
  477. printf("Component Added: %d",componentid);
  478. SaveModsForAll(vehicleid);
  479. return 1;
  480. }
  481.  
  482. public OnVehiclePaintjob(playerid,vehicleid, paintjobid)
  483. {
  484. TuneCar[vehicleid][paintjob]=paintjobid;
  485. return 1;
  486. }
  487. //
  488.  
  489. public LoadModsForAll(vehicleid)
  490. {
  491. new formatLD[256];
  492. format(formatLD,sizeof(formatLD),"blackfox_carlist/%d.mods",vehicleid);
  493. if(dini_Exists(formatLD))
  494. {
  495. TuneCar[vehicleid][mod1] = dini_Int(formatLD, "mod1");
  496. TuneCar[vehicleid][mod2] = dini_Int(formatLD, "mod2");
  497. TuneCar[vehicleid][mod3] = dini_Int(formatLD, "mod3");
  498. TuneCar[vehicleid][mod4] = dini_Int(formatLD, "mod4");
  499. TuneCar[vehicleid][mod5] = dini_Int(formatLD, "mod5");
  500.  
  501. TuneCar[vehicleid][mod6] = dini_Int(formatLD, "mod6");
  502. TuneCar[vehicleid][mod7] = dini_Int(formatLD, "mod7");
  503. TuneCar[vehicleid][mod8] = dini_Int(formatLD, "mod8");
  504. TuneCar[vehicleid][mod9] = dini_Int(formatLD, "mod9");
  505. TuneCar[vehicleid][mod10] = dini_Int(formatLD, "mod10");
  506.  
  507. TuneCar[vehicleid][mod11] = dini_Int(formatLD, "mod11");
  508. TuneCar[vehicleid][mod12] = dini_Int(formatLD, "mod12");
  509. TuneCar[vehicleid][mod13] = dini_Int(formatLD, "mod13");
  510. TuneCar[vehicleid][mod14] = dini_Int(formatLD, "mod14");
  511. TuneCar[vehicleid][mod15] = dini_Int(formatLD, "mod15");
  512.  
  513. TuneCar[vehicleid][mod16] = dini_Int(formatLD, "mod16");
  514. TuneCar[vehicleid][mod17] = dini_Int(formatLD, "mod17");
  515. TuneCar[vehicleid][paintjob] = dini_Int(formatLD, "paintjob");
  516. TuneCar[vehicleid][colorA] = dini_Int(formatLD, "color1");
  517. TuneCar[vehicleid][colorB] = dini_Int(formatLD, "color2");
  518. }
  519. else
  520. {
  521. dini_Create(formatLD);
  522. }
  523. return 0;
  524. }
  525. public SaveModsForAll(vehicleid)
  526. {
  527. new formatLD[256];
  528. format(formatLD,sizeof(formatLD),"blackfox_carlist/%d.mods",vehicleid);
  529. if(dini_Exists(formatLD))
  530. {
  531. dini_IntSet(formatLD,"mod1",TuneCar[vehicleid][mod1]);
  532. dini_IntSet(formatLD,"mod2",TuneCar[vehicleid][mod2]);
  533. dini_IntSet(formatLD,"mod3",TuneCar[vehicleid][mod3]);
  534. dini_IntSet(formatLD,"mod4",TuneCar[vehicleid][mod4]);
  535. dini_IntSet(formatLD,"mod5",TuneCar[vehicleid][mod5]);
  536. dini_IntSet(formatLD,"mod6",TuneCar[vehicleid][mod6]);
  537. dini_IntSet(formatLD,"mod7",TuneCar[vehicleid][mod8]);
  538. dini_IntSet(formatLD,"mod9",TuneCar[vehicleid][mod9]);
  539. dini_IntSet(formatLD,"mod10",TuneCar[vehicleid][mod10]);
  540. dini_IntSet(formatLD,"mod11",TuneCar[vehicleid][mod11]);
  541. dini_IntSet(formatLD,"mod12",TuneCar[vehicleid][mod12]);
  542. dini_IntSet(formatLD,"mod13",TuneCar[vehicleid][mod13]);
  543. dini_IntSet(formatLD,"mod14",TuneCar[vehicleid][mod14]);
  544. dini_IntSet(formatLD,"mod15",TuneCar[vehicleid][mod15]);
  545. dini_IntSet(formatLD,"mod16",TuneCar[vehicleid][mod16]);
  546. dini_IntSet(formatLD,"mod17",TuneCar[vehicleid][mod17]);
  547. dini_IntSet(formatLD,"paintjob",TuneCar[vehicleid][paintjob]);
  548. dini_IntSet(formatLD,"color1",TuneCar[vehicleid][colorA]);
  549. dini_IntSet(formatLD,"color2",TuneCar[vehicleid][colorB]);
  550. }
  551. else
  552. {
  553. dini_Create(formatLD);
  554. dini_IntSet(formatLD,"mod1",TuneCar[vehicleid][mod1]);
  555. dini_IntSet(formatLD,"mod2",TuneCar[vehicleid][mod2]);
  556. dini_IntSet(formatLD,"mod3",TuneCar[vehicleid][mod3]);
  557. dini_IntSet(formatLD,"mod4",TuneCar[vehicleid][mod4]);
  558. dini_IntSet(formatLD,"mod5",TuneCar[vehicleid][mod5]);
  559. dini_IntSet(formatLD,"mod6",TuneCar[vehicleid][mod6]);
  560. dini_IntSet(formatLD,"mod7",TuneCar[vehicleid][mod8]);
  561. dini_IntSet(formatLD,"mod9",TuneCar[vehicleid][mod9]);
  562. dini_IntSet(formatLD,"mod10",TuneCar[vehicleid][mod10]);
  563. dini_IntSet(formatLD,"mod11",TuneCar[vehicleid][mod11]);
  564. dini_IntSet(formatLD,"mod12",TuneCar[vehicleid][mod12]);
  565. dini_IntSet(formatLD,"mod13",TuneCar[vehicleid][mod13]);
  566. dini_IntSet(formatLD,"mod14",TuneCar[vehicleid][mod14]);
  567. dini_IntSet(formatLD,"mod15",TuneCar[vehicleid][mod15]);
  568. dini_IntSet(formatLD,"mod16",TuneCar[vehicleid][mod16]);
  569. dini_IntSet(formatLD,"mod17",TuneCar[vehicleid][mod17]);
  570. dini_IntSet(formatLD,"paintjob",TuneCar[vehicleid][paintjob]);
  571. dini_IntSet(formatLD,"color1",TuneCar[vehicleid][colorA]);
  572. dini_IntSet(formatLD,"color2",TuneCar[vehicleid][colorB]);
  573. }
  574. return 0;
  575. }
  576. public OnVehicleRespray(playerid,vehicleid, color1, color2)
  577. {
  578. TuneCar[vehicleid][colorA] = color1;
  579. TuneCar[vehicleid][colorB] = color2;
  580. return 1;
  581. }
Advertisement
Add Comment
Please, Sign In to add comment