Advertisement
Guest User

DraKoN sALVAR tUNING

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