Advertisement
Guest User

AVS ENG

a guest
Feb 16th, 2015
2,787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 95.42 KB | None | 0 0
  1. //==============================[ Includes ]====================================
  2.  
  3. #include <a_samp>
  4. #include <zcmd>
  5. #include <GetVehicleColor>
  6. #include <sscanf2>
  7. #include <YSI\y_ini>
  8.  
  9. //==============================[ Definitions ]=================================
  10.  
  11. #define SPD ShowPlayerDialog
  12. #define DSL DIALOG_STYLE_LIST
  13. #define DSI DIALOG_STYLE_INPUT
  14. #define D_TOP "Tuning by Dimi"
  15. #define D_OK "Ok"
  16. #define D_CANCEL "Cancel"
  17. #define D_TEXT "Paintjobs\nColors\nExhausts\nFront Bumper\nRear Bumper\nRoof\nSpoilers\nSide Skirts\nWheels\nCar Stereo\nHydraulics\nNitro"
  18.  
  19. #define T_FILE "Tuning/%s.ini"
  20. #define TG_FILE "TGarage/%d.ini"
  21.  
  22. #define MAX_GARAGES 100
  23.  
  24. #define dialog_TUNING 1323
  25. #define dialog_TUNING_2 1324
  26.  
  27. #define COLOR_PRICE 100
  28.  
  29. #define COLOR_RED 0xfa5555AA
  30. #define COLOR_ORANGE 0xFF6600FF
  31.  
  32. #define SendErrorMessage(%0,%1) \
  33. SendClientMessage(%0, COLOR_RED, "ERROR | {FFFFFF} "%1)
  34.  
  35. //===========================[ News and Enums ]=================================
  36.  
  37. new PlayerText:TuningBuy[ MAX_PLAYERS ][ 14 ];
  38.  
  39. enum Vehicle {
  40. vVehID,
  41. vOwner[ MAX_PLAYER_NAME ],
  42. bool:vTuned,
  43. vSpoiler,
  44. vHood,
  45. vRoof,
  46. vSkirt,
  47. vLamps,
  48. vNitro,
  49. vExhaust,
  50. vWheels,
  51. vStereo,
  52. vHydraulics,
  53. vFrontBumper,
  54. vRearBumper,
  55. vRightVent,
  56. vLeftVent,
  57. vColor1,
  58. vColor2,
  59. vPaintJob
  60. }
  61. new VehicleInfo[ MAX_VEHICLES ][ Vehicle ];
  62.  
  63. enum aaa {
  64. Float:Position[ 3 ],
  65. Text3D:tg3D,
  66. tgPickup,
  67. }
  68. new tGarage[ MAX_GARAGES ][ aaa ];
  69.  
  70. enum PaintjobInfi {
  71. vehID,
  72. pNumber,
  73. pPrice,
  74. pName[ 12 ]
  75. };
  76. #define NUMBER_TYPE_PAINTJOB 36
  77. static const
  78. pjInfo[ NUMBER_TYPE_PAINTJOB ][ PaintjobInfi ] = {
  79. { 483, 0, 100, "Paintjob 1" },
  80. { 534, 0, 100, "Paintjob 1" },
  81. { 534, 1, 100, "Paintjob 2" },
  82. { 534, 2, 100, "Paintjob 3" },
  83. { 535, 0, 100, "Paintjob 1" },
  84. { 535, 1, 100, "Paintjob 2" },
  85. { 535, 2, 100, "Paintjob 3" },
  86. { 536, 0, 100, "Paintjob 1" },
  87. { 536, 1, 100, "Paintjob 2" },
  88. { 536, 2, 100, "Paintjob 3" },
  89. { 558, 0, 100, "Paintjob 1" },
  90. { 558, 1, 100, "Paintjob 2" },
  91. { 558, 2, 100, "Paintjob 3" },
  92. { 559, 0, 100, "Paintjob 1" },
  93. { 559, 1, 100, "Paintjob 2" },
  94. { 559, 2, 100, "Paintjob 3" },
  95. { 560, 0, 100, "Paintjob 1" },
  96. { 560, 1, 100, "Paintjob 2" },
  97. { 560, 2, 100, "Paintjob 3" },
  98. { 561, 0, 100, "Paintjob 1" },
  99. { 561, 1, 100, "Paintjob 2" },
  100. { 561, 2, 100, "Paintjob 3" },
  101. { 562, 0, 100, "Paintjob 1" },
  102. { 562, 1, 100, "Paintjob 2" },
  103. { 562, 2, 100, "Paintjob 3" },
  104. { 565, 0, 100, "Paintjob 1" },
  105. { 565, 1, 100, "Paintjob 2" },
  106. { 565, 2, 100, "Paintjob 3" },
  107. { 567, 0, 100, "Paintjob 1" },
  108. { 567, 1, 100, "Paintjob 2" },
  109. { 567, 2, 100, "Paintjob 3" },
  110. { 575, 0, 100, "Paintjob 1" },
  111. { 575, 1, 100, "Paintjob 2" },
  112. { 576, 0, 100, "Paintjob 1" },
  113. { 576, 1, 100, "Paintjob 2" },
  114. { 576, 2, 100, "Paintjob 3" }
  115. };
  116.  
  117. enum ComponentsInfo {
  118. cID,
  119. cName[ 40 ],
  120. cPrice,
  121. cType
  122. };
  123. #define MAX_COMPONENTS 194
  124. static const
  125. cInfo[ MAX_COMPONENTS ][ ComponentsInfo ] = {
  126. { 1000, "Pro Spoiler", 100, CARMODTYPE_SPOILER },
  127. { 1001, "Win Spoiler", 100, CARMODTYPE_SPOILER },
  128. { 1002, "Drag Spoiler", 100, CARMODTYPE_SPOILER },
  129. { 1003, "Alpha Spoiler", 100, CARMODTYPE_SPOILER },
  130. { 1004, "Champ Scoop Hood", 100, CARMODTYPE_HOOD },
  131. { 1005, "Fury Scoop Hood", 100, CARMODTYPE_HOOD },
  132. { 1006, "Roof Scoop Roof", 100, CARMODTYPE_ROOF },
  133. { 1007, "Right Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  134. { 1008, "5x Nitrous", 100, CARMODTYPE_NITRO },
  135. { 1009, "2x Nitrous", 100, CARMODTYPE_NITRO },
  136. { 1010, "10x Nitrous", 100, CARMODTYPE_NITRO },
  137. { 1011, "Race Scoop Hood", 100, CARMODTYPE_HOOD },
  138. { 1012, "Worx Scoop Hood", 100, CARMODTYPE_HOOD },
  139. { 1013, "Round Fog Lamp", 100, CARMODTYPE_LAMPS },
  140. { 1014, "Champ Spoiler", 100, CARMODTYPE_SPOILER },
  141. { 1015, "Race Spoiler", 100, CARMODTYPE_SPOILER },
  142. { 1016, "Worx Spoiler", 100, CARMODTYPE_SPOILER },
  143. { 1017, "Left Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  144. { 1018, "Upswept Exhaust", 100, CARMODTYPE_EXHAUST },
  145. { 1019, "Twin Exhaust", 100, CARMODTYPE_EXHAUST },
  146. { 1020, "Large Exhaust", 100, CARMODTYPE_EXHAUST },
  147. { 1021, "Medium Exhaust", 100, CARMODTYPE_EXHAUST },
  148. { 1022, "Small Exhaust", 100, CARMODTYPE_EXHAUST },
  149. { 1023, "Fury Spoiler", 100, CARMODTYPE_SPOILER },
  150. { 1024, "Square Fog Lamp", 100, CARMODTYPE_LAMPS },
  151. { 1025, "Offroad Wheels", 100, CARMODTYPE_WHEELS },
  152. { 1026, "Right Alien Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  153. { 1027, "Left Alien Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  154. { 1028, "Alien Exhaust", 100, CARMODTYPE_EXHAUST },
  155. { 1029, "X-Flow Exhaust", 100, CARMODTYPE_EXHAUST },
  156. { 1030, "Left X-Flow Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  157. { 1031, "Right X-Flow Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  158. { 1032, "Alien Roof Vent", 100, CARMODTYPE_ROOF },
  159. { 1033, "X-Flow Roof Vent", 100, CARMODTYPE_ROOF },
  160. { 1034, "Alien Exhaust", 100, CARMODTYPE_EXHAUST },
  161. { 1035, "X-Flow Roof Vent", 100, CARMODTYPE_ROOF },
  162. { 1036, "Right Alien Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  163. { 1037, "X-Flow Exhaust", 100, CARMODTYPE_EXHAUST },
  164. { 1038, "Alien Roof Vent", 100, CARMODTYPE_ROOF },
  165. { 1039, "Left X-Flow Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  166. { 1040, "Left Alien Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  167. { 1041, "Right X-Flow Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  168. { 1042, "Right Chrome Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  169. { 1043, "Slamin Exhaust", 100, CARMODTYPE_EXHAUST },
  170. { 1044, "Chrome Exhaust", 100, CARMODTYPE_EXHAUST },
  171. { 1045, "X-Flow Exhaust", 100, CARMODTYPE_EXHAUST },
  172. { 1046, "Alien Exhaust", 100, CARMODTYPE_EXHAUST },
  173. { 1047, "Right Alien Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  174. { 1048, "Right X-Flow Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  175. { 1049, "Alien Spoiler", 100, CARMODTYPE_SPOILER },
  176. { 1050, "X-Flow Spoiler", 100, CARMODTYPE_SPOILER },
  177. { 1051, "Left Alien Sideskirt", 100, CARMODTYPE_SPOILER },
  178. { 1052, "Left X-Flow Sideskirt", 100, CARMODTYPE_SPOILER },
  179. { 1053, "X-Flow Roof", 100, CARMODTYPE_ROOF },
  180. { 1054, "Alien Roof", 100, CARMODTYPE_ROOF },
  181. { 1055, "Alien Roof", 100, CARMODTYPE_ROOF },
  182. { 1056, "Right Alien Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  183. { 1057, "Right X-Flow Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  184. { 1058, "Alien Spoiler", 100, CARMODTYPE_SPOILER },
  185. { 1059, "X-Flow Exhaust", 100, CARMODTYPE_EXHAUST },
  186. { 1060, "X-Flow Spoiler", 100, CARMODTYPE_SPOILER },
  187. { 1061, "X-Flow Roof", 100, CARMODTYPE_ROOF },
  188. { 1062, "Left Alien Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  189. { 1063, "Left X-Flow Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  190. { 1064, "Alien Exhaust", 100, CARMODTYPE_EXHAUST },
  191. { 1065, "Alien Exhaust", 100, CARMODTYPE_EXHAUST },
  192. { 1066, "X-Flow Exhaust", 100, CARMODTYPE_EXHAUST },
  193. { 1067, "Alien Roof", 100, CARMODTYPE_ROOF },
  194. { 1068, "X-Flow Roof", 100, CARMODTYPE_ROOF },
  195. { 1069, "Right Alien Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  196. { 1070, "Right X-Flow Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  197. { 1071, "Left Alien Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  198. { 1072, "Left X-Flow Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  199. { 1073, "Shadow Wheels", 100, CARMODTYPE_WHEELS },
  200. { 1074, "Mega Wheels", 100, CARMODTYPE_WHEELS },
  201. { 1075, "Rimshine Wheels", 100, CARMODTYPE_WHEELS },
  202. { 1076, "Wires Wheels", 100, CARMODTYPE_WHEELS },
  203. { 1077, "Classic Wheels", 100, CARMODTYPE_WHEELS },
  204. { 1078, "Twist Wheels", 100, CARMODTYPE_WHEELS },
  205. { 1079, "Cutter Wheels", 100, CARMODTYPE_WHEELS },
  206. { 1080, "Switch Wheels", 100, CARMODTYPE_WHEELS },
  207. { 1081, "Grove Wheels", 100, CARMODTYPE_WHEELS },
  208. { 1082, "Import Wheels", 100, CARMODTYPE_WHEELS },
  209. { 1083, "Dollar Wheels", 100, CARMODTYPE_WHEELS },
  210. { 1084, "Trance Wheels", 100, CARMODTYPE_WHEELS },
  211. { 1085, "Atomic Wheels", 100, CARMODTYPE_WHEELS },
  212. { 1086, "Stereo Wheels", 100, CARMODTYPE_STEREO },
  213. { 1087, "Hydraulics", 100, CARMODTYPE_HYDRAULICS },
  214. { 1088, "Alien Roof", 100, CARMODTYPE_ROOF },
  215. { 1089, "X-Flow Exhaust", 100, CARMODTYPE_EXHAUST },
  216. { 1090, "Right Alien Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  217. { 1091, "X-Flow Roof", 100, CARMODTYPE_ROOF },
  218. { 1092, "Alien Exhaust", 100, CARMODTYPE_EXHAUST },
  219. { 1093, "Right X-Flow Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  220. { 1094, "Left Alien Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  221. { 1095, "Right X-Flow Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  222. { 1096, "Ahab Wheels", 100, CARMODTYPE_WHEELS },
  223. { 1097, "Virtual Wheels", 100, CARMODTYPE_WHEELS },
  224. { 1098, "Access Wheels", 100, CARMODTYPE_WHEELS },
  225. { 1099, "Left Chrome Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  226. { 1100, "Chrome Grill", 100, -1 }, // Bullbar
  227. { 1101, "Left `Chrome Flames` Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  228. { 1102, "Left `Chrome Strip` Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  229. { 1103, "Covertible Roof", 100, CARMODTYPE_ROOF },
  230. { 1104, "Chrome Exhaust", 100, CARMODTYPE_EXHAUST },
  231. { 1105, "Slamin Exhaust", 100, CARMODTYPE_EXHAUST },
  232. { 1106, "Right `Chrome Arches`", 100, CARMODTYPE_SIDESKIRT },
  233. { 1107, "Left `Chrome Strip` Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  234. { 1108, "Right `Chrome Strip` Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  235. { 1109, "Chrome", 100, -1 }, // Bullbar
  236. { 1110, "Slamin", 100, -1 }, // Bullbar
  237. { 1111, "Little Sign?", 100, -1 }, // sig
  238. { 1112, "Little Sign?", 100, -1 }, // sig
  239. { 1113, "Chrome Exhaust", 100, CARMODTYPE_EXHAUST },
  240. { 1114, "Slamin Exhaust", 100, CARMODTYPE_EXHAUST },
  241. { 1115, "Chrome", 100, -1 }, // Bullbar
  242. { 1116, "Slamin", 100, -1 }, // Bullbar
  243. { 1117, "Chrome Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  244. { 1118, "Right `Chrome Trim` Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  245. { 1119, "Right `Wheelcovers` Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  246. { 1120, "Left `Chrome Trim` Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  247. { 1121, "Left `Wheelcovers` Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  248. { 1122, "Right `Chrome Flames` Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  249. { 1123, "Bullbar Chrome Bars", 100, -1 }, // Bullbar
  250. { 1124, "Left `Chrome Arches` Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  251. { 1125, "Bullbar Chrome Lights", 100, -1 }, // Bullbar
  252. { 1126, "Chrome Exhaust", 100, CARMODTYPE_EXHAUST },
  253. { 1127, "Slamin Exhaust", 100, CARMODTYPE_EXHAUST },
  254. { 1128, "Vinyl Hardtop", 100, CARMODTYPE_ROOF },
  255. { 1129, "Chrome Exhaust", 100, CARMODTYPE_EXHAUST },
  256. { 1130, "Hardtop Roof", 100, CARMODTYPE_ROOF },
  257. { 1131, "Softtop Roof", 100, CARMODTYPE_ROOF },
  258. { 1132, "Slamin Exhaust", 100, CARMODTYPE_EXHAUST },
  259. { 1133, "Right `Chrome Strip` Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  260. { 1134, "Right `Chrome Strip` Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  261. { 1135, "Slamin Exhaust", 100, CARMODTYPE_EXHAUST },
  262. { 1136, "Chrome Exhaust", 100, CARMODTYPE_EXHAUST },
  263. { 1137, "Left `Chrome Strip` Sideskirt", 100, CARMODTYPE_SIDESKIRT },
  264. { 1138, "Alien Spoiler", 100, CARMODTYPE_SPOILER },
  265. { 1139, "X-Flow Spoiler", 100, CARMODTYPE_SPOILER },
  266. { 1140, "X-Flow Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  267. { 1141, "Alien Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  268. { 1142, "Left Oval Vents", 100, CARMODTYPE_VENT_LEFT },
  269. { 1143, "Right Oval Vents", 100, CARMODTYPE_VENT_RIGHT },
  270. { 1144, "Left Square Vents", 100, CARMODTYPE_VENT_LEFT },
  271. { 1145, "Right Square Vents", 100, CARMODTYPE_VENT_RIGHT },
  272. { 1146, "X-Flow Spoiler", 100, CARMODTYPE_SPOILER },
  273. { 1147, "Alien Spoiler", 100, CARMODTYPE_SPOILER },
  274. { 1148, "X-Flow Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  275. { 1149, "Alien Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  276. { 1150, "Alien Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  277. { 1151, "X-Flow Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  278. { 1152, "X-Flow Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  279. { 1153, "Alien Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  280. { 1154, "Alien Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  281. { 1155, "Alien Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  282. { 1156, "X-Flow Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  283. { 1157, "X-Flow Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  284. { 1158, "X-Flow Spoiler", 100, CARMODTYPE_SPOILER },
  285. { 1159, "Alien Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  286. { 1160, "Alien Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  287. { 1161, "X-Flow Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  288. { 1162, "Alien Spoiler", 100, CARMODTYPE_SPOILER },
  289. { 1163, "X-Flow Spoiler", 100, CARMODTYPE_SPOILER },
  290. { 1164, "Alien Spoiler", 100, CARMODTYPE_SPOILER },
  291. { 1165, "X-Flow Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  292. { 1166, "Alien Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  293. { 1167, "X-Flow Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  294. { 1168, "Alien Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  295. { 1169, "Alien Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  296. { 1170, "X-Flow Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  297. { 1171, "Alien Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  298. { 1172, "X-Flow Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  299. { 1173, "X-Flow Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  300. { 1174, "Chrome Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  301. { 1175, "Slamin Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  302. { 1176, "Chrome Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  303. { 1177, "Slamin Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  304. { 1178, "Slamin Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  305. { 1179, "Chrome Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  306. { 1180, "Chrome Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  307. { 1181, "Slamin Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  308. { 1182, "Chrome Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  309. { 1183, "Slamin Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  310. { 1184, "Chrome Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  311. { 1185, "Slamin Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  312. { 1186, "Slamin Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  313. { 1187, "Chrome Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  314. { 1188, "Slamin Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  315. { 1189, "Chrome Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  316. { 1190, "Slamin Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  317. { 1191, "Chrome Front Bumper", 100, CARMODTYPE_FRONT_BUMPER },
  318. { 1192, "Chrome Rear Bumper", 100, CARMODTYPE_REAR_BUMPER },
  319. { 1193, "Slamin Rear Bumper", 100, CARMODTYPE_REAR_BUMPER }
  320. };
  321.  
  322.  
  323. enum tpi {
  324. tID,
  325. tType,
  326. bool:tPaintjob,
  327. PJColor[ 2 ]
  328. };
  329. new TPInfo[ MAX_PLAYERS ][ tpi ];
  330.  
  331. new globalstring[ 128 ];
  332.  
  333. //=================================[ Functions ]=================================
  334. stock CreatePlayerTextDraws( playerid ) {
  335.  
  336. TuningBuy[ playerid ][ 0 ] = CreatePlayerTextDraw(playerid, 425.125000, 338.666687, "usebox");
  337. PlayerTextDrawLetterSize(playerid, TuningBuy[ playerid ][ 0 ], 0.000000, 8.627778);
  338. PlayerTextDrawTextSize(playerid, TuningBuy[ playerid ][ 0 ], 216.125000, 0.000000);
  339. PlayerTextDrawAlignment(playerid, TuningBuy[ playerid ][ 0 ], 1);
  340. PlayerTextDrawColor(playerid, TuningBuy[ playerid ][ 0 ], 0);
  341. PlayerTextDrawUseBox(playerid, TuningBuy[ playerid ][ 0 ], true);
  342. PlayerTextDrawBoxColor(playerid, TuningBuy[ playerid ][ 0 ], 102);
  343. PlayerTextDrawSetShadow(playerid, TuningBuy[ playerid ][ 0 ], 0);
  344. PlayerTextDrawSetOutline(playerid, TuningBuy[ playerid ][ 0 ], 0);
  345. PlayerTextDrawFont(playerid, TuningBuy[ playerid ][ 0 ], 0);
  346.  
  347. TuningBuy[ playerid ][ 1 ] = CreatePlayerTextDraw(playerid, 319.375000, 337.749847, "Hydraulics");
  348. PlayerTextDrawLetterSize(playerid, TuningBuy[ playerid ][ 1 ], 0.386249, 1.156664);
  349. PlayerTextDrawAlignment(playerid, TuningBuy[ playerid ][ 1 ], 2);
  350. PlayerTextDrawColor(playerid, TuningBuy[ playerid ][ 1 ], -1);
  351. PlayerTextDrawSetShadow(playerid, TuningBuy[ playerid ][ 1 ], 0);
  352. PlayerTextDrawSetOutline(playerid, TuningBuy[ playerid ][ 1 ], 1);
  353. PlayerTextDrawBackgroundColor(playerid, TuningBuy[ playerid ][ 1 ], 51 );
  354. PlayerTextDrawFont(playerid, TuningBuy[ playerid ][ 1 ], 2);
  355. PlayerTextDrawSetProportional(playerid, TuningBuy[ playerid ][ 1 ], 1 );
  356. PlayerTextDrawSetSelectable(playerid, TuningBuy[ playerid ][ 1 ], false );
  357.  
  358. TuningBuy[ playerid ][ 2 ] = CreatePlayerTextDraw(playerid, 198.375000, 361.583282, "-");
  359. PlayerTextDrawLetterSize(playerid, TuningBuy[ playerid ][ 2 ], 18.981874, 0.514999);
  360. PlayerTextDrawAlignment(playerid, TuningBuy[ playerid ][ 2 ], 1);
  361. PlayerTextDrawColor(playerid, TuningBuy[ playerid ][ 2 ], -10092289);
  362. PlayerTextDrawSetShadow(playerid, TuningBuy[ playerid ][ 2 ], 0);
  363. PlayerTextDrawSetOutline(playerid, TuningBuy[ playerid ][ 2 ], 1);
  364. PlayerTextDrawBackgroundColor(playerid, TuningBuy[ playerid ][ 2 ], 51);
  365. PlayerTextDrawFont(playerid, TuningBuy[ playerid ][ 2 ], 2);
  366. PlayerTextDrawSetProportional(playerid, TuningBuy[ playerid ][ 2 ], 1);
  367.  
  368. TuningBuy[ playerid ][ 3 ] = CreatePlayerTextDraw(playerid, 222.500000, 352.916656, "Left `Chrome Flames` Sideskirt");
  369. PlayerTextDrawLetterSize(playerid, TuningBuy[ playerid ][ 3 ], 0.244999, 1.092499);
  370. PlayerTextDrawAlignment(playerid, TuningBuy[ playerid ][ 3 ], 1);
  371. PlayerTextDrawColor(playerid, TuningBuy[ playerid ][ 3 ], -1);
  372. PlayerTextDrawSetShadow(playerid, TuningBuy[ playerid ][ 3 ], 0);
  373. PlayerTextDrawSetOutline(playerid, TuningBuy[ playerid ][ 3 ], 1);
  374. PlayerTextDrawBackgroundColor(playerid, TuningBuy[ playerid ][ 3 ], 51);
  375. PlayerTextDrawFont(playerid, TuningBuy[ playerid ][ 3 ], 2);
  376. PlayerTextDrawSetProportional(playerid, TuningBuy[ playerid ][ 3 ], 1);
  377.  
  378. TuningBuy[ playerid ][ 4 ] = CreatePlayerTextDraw(playerid, 222.500000, 365.000000, "price: ~w~10000$");
  379. PlayerTextDrawLetterSize(playerid, TuningBuy[ playerid ][ 4 ], 0.244999, 1.092499);
  380. PlayerTextDrawAlignment(playerid, TuningBuy[ playerid ][ 4 ], 1);
  381. PlayerTextDrawColor(playerid, TuningBuy[ playerid ][ 4 ], -1);
  382. PlayerTextDrawSetShadow(playerid, TuningBuy[ playerid ][ 4 ], 0);
  383. PlayerTextDrawSetOutline(playerid, TuningBuy[ playerid ][ 4 ], 1);
  384. PlayerTextDrawBackgroundColor(playerid, TuningBuy[ playerid ][ 4 ], 51);
  385. PlayerTextDrawFont(playerid, TuningBuy[ playerid ][ 4 ], 2);
  386. PlayerTextDrawSetProportional(playerid, TuningBuy[ playerid ][ 4 ], 1);
  387.  
  388. TuningBuy[ playerid ][ 5 ] = CreatePlayerTextDraw(playerid, 215.125000, 372.999877, "-");
  389. PlayerTextDrawLetterSize(playerid, TuningBuy[ playerid ][ 5 ], 6.743125, 0.444999);
  390. PlayerTextDrawAlignment(playerid, TuningBuy[ playerid ][ 5 ], 1);
  391. PlayerTextDrawColor(playerid, TuningBuy[ playerid ][ 5 ], -10092289);
  392. PlayerTextDrawSetShadow(playerid, TuningBuy[ playerid ][ 5 ], 0);
  393. PlayerTextDrawSetOutline(playerid, TuningBuy[ playerid ][ 5 ], 1);
  394. PlayerTextDrawBackgroundColor(playerid, TuningBuy[ playerid ][ 5 ], 51);
  395. PlayerTextDrawFont(playerid, TuningBuy[ playerid ][ 5 ], 2);
  396. PlayerTextDrawSetProportional(playerid, TuningBuy[ playerid ][ 5 ], 1);
  397.  
  398. TuningBuy[ playerid ][ 6 ] = CreatePlayerTextDraw(playerid, 206.750000, 347.166564, "-");
  399. PlayerTextDrawLetterSize(playerid, TuningBuy[ playerid ][ 6 ], 18.981874, 0.514999);
  400. PlayerTextDrawAlignment(playerid, TuningBuy[ playerid ][ 6 ], 1);
  401. PlayerTextDrawColor(playerid, TuningBuy[ playerid ][ 6 ], -10092289);
  402. PlayerTextDrawSetShadow(playerid, TuningBuy[ playerid ][ 6 ], 0);
  403. PlayerTextDrawSetOutline(playerid, TuningBuy[ playerid ][ 6 ], 1);
  404. PlayerTextDrawBackgroundColor(playerid, TuningBuy[ playerid ][ 6 ], 51);
  405. PlayerTextDrawFont(playerid, TuningBuy[ playerid ][ 6 ], 2);
  406. PlayerTextDrawSetProportional(playerid, TuningBuy[ playerid ][ 6 ], 1);
  407.  
  408. TuningBuy[ playerid ][ 7 ] = CreatePlayerTextDraw(playerid, 385.000000, 381.500000, "ld_beat:right");
  409. PlayerTextDrawLetterSize(playerid, TuningBuy[ playerid ][ 7 ], 0.449999, 1.600000);
  410. PlayerTextDrawTextSize(playerid, TuningBuy[ playerid ][ 7 ], 27.500000, 13.416657);
  411. PlayerTextDrawAlignment(playerid, TuningBuy[ playerid ][ 7 ], 2);
  412. PlayerTextDrawColor(playerid, TuningBuy[ playerid ][ 7 ], -1);
  413. PlayerTextDrawUseBox(playerid, TuningBuy[ playerid ][ 7 ], true);
  414. PlayerTextDrawBoxColor(playerid, TuningBuy[ playerid ][ 7 ], 255);
  415. PlayerTextDrawSetShadow(playerid, TuningBuy[ playerid ][ 7 ], 0);
  416. PlayerTextDrawSetOutline(playerid, TuningBuy[ playerid ][ 7 ], 1);
  417. PlayerTextDrawBackgroundColor(playerid, TuningBuy[ playerid ][ 7 ], 51);
  418. PlayerTextDrawFont(playerid, TuningBuy[ playerid ][ 7 ], 4);
  419. PlayerTextDrawSetProportional(playerid, TuningBuy[ playerid ][ 7 ], 1);
  420. PlayerTextDrawSetSelectable(playerid, TuningBuy[ playerid ][ 7 ], true);
  421.  
  422. TuningBuy[ playerid ][ 8 ] = CreatePlayerTextDraw(playerid, 230.375000, 381.916473, "ld_beat:left");
  423. PlayerTextDrawLetterSize(playerid, TuningBuy[ playerid ][ 8 ], 0.449999, 1.600000);
  424. PlayerTextDrawTextSize(playerid, TuningBuy[ playerid ][ 8 ], 27.500000, 13.416657);
  425. PlayerTextDrawAlignment(playerid, TuningBuy[ playerid ][ 8 ], 2);
  426. PlayerTextDrawColor(playerid, TuningBuy[ playerid ][ 8 ], -1);
  427. PlayerTextDrawUseBox(playerid, TuningBuy[ playerid ][ 8 ], true);
  428. PlayerTextDrawBoxColor(playerid, TuningBuy[ playerid ][ 8 ], 255);
  429. PlayerTextDrawSetShadow(playerid, TuningBuy[ playerid ][ 8 ], 0);
  430. PlayerTextDrawSetOutline(playerid, TuningBuy[ playerid ][ 8 ], 1);
  431. PlayerTextDrawBackgroundColor(playerid, TuningBuy[ playerid ][ 8 ], 51);
  432. PlayerTextDrawFont(playerid, TuningBuy[ playerid ][ 8 ], 4);
  433. PlayerTextDrawSetProportional(playerid, TuningBuy[ playerid ][ 8 ], 1);
  434. PlayerTextDrawSetSelectable(playerid, TuningBuy[ playerid ][ 8 ], true);
  435.  
  436. TuningBuy[ playerid ][ 9 ] = CreatePlayerTextDraw(playerid, 320.000000, 381.499938, "BUY");
  437. PlayerTextDrawTextSize(playerid, TuningBuy[ playerid ][ 9 ], 23.000000, 13.000000 );
  438. PlayerTextDrawLetterSize(playerid, TuningBuy[ playerid ][ 9 ], 0.421249, 1.360832 );
  439. PlayerTextDrawAlignment(playerid, TuningBuy[ playerid ][ 9 ], 2);
  440. PlayerTextDrawColor(playerid, TuningBuy[ playerid ][ 9 ], -1);
  441. PlayerTextDrawSetShadow(playerid, TuningBuy[ playerid ][ 9 ], 0);
  442. PlayerTextDrawSetOutline(playerid, TuningBuy[ playerid ][ 9 ], 1);
  443. PlayerTextDrawBackgroundColor(playerid, TuningBuy[ playerid ][ 9 ], 51);
  444. PlayerTextDrawFont(playerid, TuningBuy[ playerid ][ 9 ], 2);
  445. PlayerTextDrawSetProportional(playerid, TuningBuy[ playerid ][ 9 ], 1);
  446. PlayerTextDrawSetSelectable(playerid, TuningBuy[ playerid ][ 9 ], true);
  447.  
  448. TuningBuy[ playerid ][ 10 ] = CreatePlayerTextDraw(playerid, 200.000000, 396.416656, "-");
  449. PlayerTextDrawLetterSize(playerid, TuningBuy[ playerid ][ 10 ], 18.981874, 0.514999);
  450. PlayerTextDrawAlignment(playerid, TuningBuy[ playerid ][ 10 ], 1);
  451. PlayerTextDrawColor(playerid, TuningBuy[ playerid ][ 10 ], -10092289);
  452. PlayerTextDrawSetShadow(playerid, TuningBuy[ playerid ][ 10 ], 0);
  453. PlayerTextDrawSetOutline(playerid, TuningBuy[ playerid ][ 10 ], 1);
  454. PlayerTextDrawBackgroundColor(playerid, TuningBuy[ playerid ][ 10 ], 51);
  455. PlayerTextDrawFont(playerid, TuningBuy[ playerid ][ 10 ], 2);
  456. PlayerTextDrawSetProportional(playerid, TuningBuy[ playerid ][ 10 ], 1);
  457.  
  458. TuningBuy[ playerid ][ 11 ] = CreatePlayerTextDraw(playerid, 225.000000, 401.916595, "Advanced tuning system by ~r~Dimi");
  459. PlayerTextDrawLetterSize(playerid, TuningBuy[ playerid ][ 11 ], 0.258749, 0.987497);
  460. PlayerTextDrawAlignment(playerid, TuningBuy[ playerid ][ 11 ], 1);
  461. PlayerTextDrawColor(playerid, TuningBuy[ playerid ][ 11 ], -1);
  462. PlayerTextDrawSetShadow(playerid, TuningBuy[ playerid ][ 11 ], 0);
  463. PlayerTextDrawSetOutline(playerid, TuningBuy[ playerid ][ 11 ], 1);
  464. PlayerTextDrawBackgroundColor(playerid, TuningBuy[ playerid ][ 11 ], 51);
  465. PlayerTextDrawFont(playerid, TuningBuy[ playerid ][ 11 ], 2);
  466. PlayerTextDrawSetProportional(playerid, TuningBuy[ playerid ][ 11 ], 1);
  467.  
  468. TuningBuy[ playerid ][ 12 ] = CreatePlayerTextDraw(playerid, 203.500000, 411.416839, "-");
  469. PlayerTextDrawLetterSize(playerid, TuningBuy[ playerid ][ 12 ], 18.981874, 0.514998);
  470. PlayerTextDrawAlignment(playerid, TuningBuy[ playerid ][ 12 ], 1);
  471. PlayerTextDrawColor(playerid, TuningBuy[ playerid ][ 12 ], -10092289);
  472. PlayerTextDrawSetShadow(playerid, TuningBuy[ playerid ][ 12 ], 0);
  473. PlayerTextDrawSetOutline(playerid, TuningBuy[ playerid ][ 12 ], 1);
  474. PlayerTextDrawBackgroundColor(playerid, TuningBuy[ playerid ][ 12 ], 51);
  475. PlayerTextDrawFont(playerid, TuningBuy[ playerid ][ 12 ], 2);
  476. PlayerTextDrawSetProportional(playerid, TuningBuy[ playerid ][ 12 ], 1);
  477.  
  478. TuningBuy[ playerid ][ 13 ] = CreatePlayerTextDraw(playerid, 404.500000, 337.999877, "ld_beat:cross");
  479. PlayerTextDrawLetterSize(playerid, TuningBuy[ playerid ][ 13 ], 0.449999, 1.600000);
  480. PlayerTextDrawTextSize(playerid, TuningBuy[ playerid ][ 13 ], 17.500000, 8.749991);
  481. PlayerTextDrawAlignment(playerid, TuningBuy[ playerid ][ 13 ], 2);
  482. PlayerTextDrawColor(playerid, TuningBuy[ playerid ][ 13 ], -1);
  483. PlayerTextDrawUseBox(playerid, TuningBuy[ playerid ][ 13 ], true);
  484. PlayerTextDrawBoxColor(playerid, TuningBuy[ playerid ][ 13 ], 255);
  485. PlayerTextDrawSetShadow(playerid, TuningBuy[ playerid ][ 13 ], 0);
  486. PlayerTextDrawSetOutline(playerid, TuningBuy[ playerid ][ 13 ], 1);
  487. PlayerTextDrawBackgroundColor(playerid, TuningBuy[ playerid ][ 13 ], 51);
  488. PlayerTextDrawFont(playerid, TuningBuy[ playerid ][ 13 ], 4);
  489. PlayerTextDrawSetProportional(playerid, TuningBuy[ playerid ][ 13 ], 1);
  490. PlayerTextDrawSetSelectable(playerid, TuningBuy[ playerid ][ 13 ], true);
  491. }
  492. //==============================================================================
  493. GetNearestTGarage( playerid ) {
  494. for(new i = 1; i < MAX_GARAGES; i++) {
  495. if( IsPlayerInRangeOfPoint( playerid, 10.0, tGarage[ i ][ Position ][ 0 ], tGarage[ i ][ Position ][ 1 ], tGarage[ i ][ Position ][ 2 ] ) ) { return i; }
  496. }
  497. return -1;
  498. }
  499. //==============================================================================
  500. forward SaveTGarage( id );
  501. public SaveTGarage( id ) {
  502. new iFile[ 40 ];
  503. format( iFile, sizeof( iFile ), TG_FILE, id );
  504. new INI:File = INI_Open( iFile );
  505. INI_WriteFloat( File, "Position1", tGarage[ id ][ Position ][ 0 ] );
  506. INI_WriteFloat( File, "Position2", tGarage[ id ][ Position ][ 1 ] );
  507. INI_WriteFloat( File, "Position3", tGarage[ id ][ Position ][ 2 ] );
  508. INI_Close( File );
  509. return 1;
  510. }
  511. //==============================================================================
  512. forward LoadTGarage( id, name[], value[] );
  513. public LoadTGarage( id, name[], value[] ) {
  514. INI_Float( "Position1", tGarage[ id ][ Position ][ 0 ] );
  515. INI_Float( "Position2", tGarage[ id ][ Position ][ 1 ] );
  516. INI_Float( "Position3", tGarage[ id ][ Position ][ 2 ] );
  517. return true;
  518. }
  519. //==============================================================================
  520. forward SaveTuning( playerid, vehicleid, string[] );
  521. public SaveTuning( playerid, vehicleid, string[] ) {
  522. new Color1, Color2;
  523. GetVehicleColor( vehicleid, Color1, Color2 );
  524. new file[ 40 ];
  525. format( file, sizeof( file ), T_FILE, string );
  526. if( fexist( file ) ) return 1;
  527. new INI:File = INI_Open( file );
  528. INI_SetTag( File, "Info" );
  529. INI_WriteInt( File, "VehID", GetVehicleModel( vehicleid ) );
  530. INI_WriteString( File, "Owner", GetName( playerid ) );
  531. INI_WriteBool( File, "Tuned", VehicleInfo[ vehicleid ][ vTuned ] );
  532. INI_WriteInt( File, "Spoiler", VehicleInfo[ vehicleid ][ vSpoiler ] );
  533. INI_WriteInt( File, "Hood", VehicleInfo[ vehicleid ][ vHood ] );
  534. INI_WriteInt( File, "Roof", VehicleInfo[ vehicleid ][ vRoof ] );
  535. INI_WriteInt( File, "Skirt", VehicleInfo[ vehicleid ][ vSkirt ] );
  536. INI_WriteInt( File, "Lamps", VehicleInfo[ vehicleid ][ vLamps ] );
  537. INI_WriteInt( File, "Nitro", VehicleInfo[ vehicleid ][ vNitro ] );
  538. INI_WriteInt( File, "Exhaust", VehicleInfo[ vehicleid ][ vExhaust ] );
  539. INI_WriteInt( File, "Wheels", VehicleInfo[ vehicleid ][ vWheels ] );
  540. INI_WriteInt( File, "Stereo", VehicleInfo[ vehicleid ][ vStereo ] );
  541. INI_WriteInt( File, "Hydraulics", VehicleInfo[ vehicleid ][ vHydraulics ] );
  542. INI_WriteInt( File, "FrontBumper", VehicleInfo[ vehicleid ][ vFrontBumper ] );
  543. INI_WriteInt( File, "RearBumper", VehicleInfo[ vehicleid ][ vRearBumper ] );
  544. INI_WriteInt( File, "RightVent", VehicleInfo[ vehicleid ][ vRightVent ] );
  545. INI_WriteInt( File, "LeftVent", VehicleInfo[ vehicleid ][ vLeftVent ] );
  546. INI_WriteInt( File, "PaintJob", VehicleInfo[ vehicleid ][ vPaintJob ] );
  547. INI_WriteInt( File, "Color1", Color1 );
  548. INI_WriteInt( File, "Color2", Color2 );
  549. INI_Close( File );
  550. return true;
  551. }
  552. //==============================================================================
  553. forward LoadTuning( id, name[], value[] );
  554. public LoadTuning( id, name[], value[] ) {
  555. INI_Int( "VehID", VehicleInfo[ id ][ vVehID ] );
  556. INI_String( "Owner", VehicleInfo[ id ][ vOwner ], MAX_PLAYER_NAME );
  557. INI_Bool( "Tuned", VehicleInfo[ id ][ vTuned ] );
  558. INI_Int( "Spoiler", VehicleInfo[ id ][ vSpoiler ] );
  559. INI_Int( "Hood", VehicleInfo[ id ][ vHood ] );
  560. INI_Int( "Roof", VehicleInfo[ id ][ vRoof ] );
  561. INI_Int( "Skirt", VehicleInfo[ id ][ vSkirt ] );
  562. INI_Int( "Lamps", VehicleInfo[ id ][ vLamps ] );
  563. INI_Int( "Nitro", VehicleInfo[ id ][ vNitro ] );
  564. INI_Int( "Exhaust", VehicleInfo[ id ][ vExhaust ] );
  565. INI_Int( "Wheels", VehicleInfo[ id ][ vWheels ] );
  566. INI_Int( "Stereo", VehicleInfo[ id ][ vStereo ] );
  567. INI_Int( "Hydraulics", VehicleInfo[ id ][ vHydraulics ] );
  568. INI_Int( "FrontBumper", VehicleInfo[ id ][ vFrontBumper ] );
  569. INI_Int( "RearBumper", VehicleInfo[ id ][ vRearBumper ] );
  570. INI_Int( "RightVent", VehicleInfo[ id ][ vRightVent ] );
  571. INI_Int( "LeftVent", VehicleInfo[ id ][ vLeftVent ] );
  572. INI_Int( "PaintJob", VehicleInfo[ id ][ vPaintJob ] );
  573. INI_Int( "Color1", VehicleInfo[ id ][ vColor1 ] );
  574. INI_Int( "Color2", VehicleInfo[ id ][ vColor2 ] );
  575. return true;
  576. }
  577. //==============================================================================
  578. stock SetTune( vehicleid ) {
  579. if( VehicleInfo[ vehicleid ][ vTuned ] ) {
  580. if( VehicleInfo[ vehicleid ][ vPaintJob ] != 255 ) ChangeVehiclePaintjob( vehicleid, VehicleInfo[ vehicleid ][ vPaintJob ] );
  581. if( VehicleInfo[ vehicleid ][ vSpoiler ] != -1 ) AddVehicleComponent( vehicleid, VehicleInfo[ vehicleid ][ vSpoiler ] );
  582. if( VehicleInfo[ vehicleid ][ vHood ] != -1 ) AddVehicleComponent( vehicleid, VehicleInfo[ vehicleid ][ vHood ] );
  583. if( VehicleInfo[ vehicleid ][ vRoof ] != -1 ) AddVehicleComponent( vehicleid, VehicleInfo[ vehicleid ][ vRoof ] );
  584. if( VehicleInfo[ vehicleid ][ vSkirt ] != -1 ) AddVehicleComponent( vehicleid, VehicleInfo[ vehicleid ][ vSkirt ] );
  585. if( VehicleInfo[ vehicleid ][ vLamps ] != -1 ) AddVehicleComponent( vehicleid, VehicleInfo[ vehicleid ][ vLamps ] );
  586. if( VehicleInfo[ vehicleid ][ vNitro ] != -1 ) AddVehicleComponent( vehicleid, VehicleInfo[ vehicleid ][ vNitro ] );
  587. if( VehicleInfo[ vehicleid ][ vExhaust ] != -1 ) AddVehicleComponent( vehicleid, VehicleInfo[ vehicleid ][ vWheels ] );
  588. if( VehicleInfo[ vehicleid ][ vWheels ] != -1 ) AddVehicleComponent( vehicleid, VehicleInfo[ vehicleid ][ vWheels ] );
  589. if( VehicleInfo[ vehicleid ][ vStereo ] != -1 ) AddVehicleComponent( vehicleid, VehicleInfo[ vehicleid ][ vStereo ] );
  590. if( VehicleInfo[ vehicleid ][ vHydraulics ] != -1 ) AddVehicleComponent( vehicleid, VehicleInfo[ vehicleid ][ vHydraulics ] );
  591. if( VehicleInfo[ vehicleid ][ vFrontBumper ] != -1 ) AddVehicleComponent( vehicleid, VehicleInfo[ vehicleid ][ vFrontBumper ] );
  592. if( VehicleInfo[ vehicleid ][ vRearBumper ] != -1 ) AddVehicleComponent( vehicleid, VehicleInfo[ vehicleid ][ vRearBumper ] );
  593. if( VehicleInfo[ vehicleid ][ vRightVent ] != -1 ) AddVehicleComponent( vehicleid, VehicleInfo[ vehicleid ][ vRightVent ] );
  594. if( VehicleInfo[ vehicleid ][ vLeftVent ] != -1 ) AddVehicleComponent( vehicleid, VehicleInfo[ vehicleid ][ vLeftVent ] );
  595. }
  596. }
  597. //==============================================================================
  598. stock AddComponentToVehicle( vehicleid, componentid ) {
  599. if( VehicleInfo[ vehicleid ][ vTuned ] ) {
  600. if( GetVehicleComponentType( componentid ) == CARMODTYPE_SPOILER ) {
  601. VehicleInfo[ vehicleid ][ vSpoiler ] = componentid;
  602. if( VehicleInfo[ vehicleid ][ vSpoiler ] != -1 ) AddVehicleComponent( vehicleid, componentid );
  603. }
  604. else if( GetVehicleComponentType( componentid ) == CARMODTYPE_HOOD ) {
  605. VehicleInfo[ vehicleid ][ vHood ] = componentid;
  606. if( VehicleInfo[ vehicleid ][ vHood ] != -1 ) AddVehicleComponent( vehicleid, componentid );
  607. }
  608. else if( GetVehicleComponentType( componentid ) == CARMODTYPE_ROOF ) {
  609. VehicleInfo[ vehicleid ][ vRoof ] = componentid;
  610. if( VehicleInfo[ vehicleid ][ vRoof ] != -1 ) AddVehicleComponent( vehicleid, componentid );
  611. }
  612. else if( GetVehicleComponentType( componentid ) == CARMODTYPE_SIDESKIRT ) {
  613. VehicleInfo[ vehicleid ][ vSkirt ] = componentid;
  614. if( VehicleInfo[ vehicleid ][ vSkirt ] != -1 ) AddVehicleComponent( vehicleid, componentid );
  615. }
  616. else if( GetVehicleComponentType( componentid ) == CARMODTYPE_LAMPS ) {
  617. VehicleInfo[ vehicleid ][ vLamps ] = componentid;
  618. if( VehicleInfo[ vehicleid ][ vLamps ] != -1 ) AddVehicleComponent( vehicleid, componentid );
  619. }
  620. else if( GetVehicleComponentType( componentid ) == CARMODTYPE_NITRO ) {
  621. VehicleInfo[ vehicleid ][ vNitro ] = componentid;
  622. if( VehicleInfo[ vehicleid ][ vNitro ] != -1 ) AddVehicleComponent( vehicleid, componentid );
  623. }
  624. else if( GetVehicleComponentType( componentid ) == CARMODTYPE_EXHAUST ) {
  625. VehicleInfo[ vehicleid ][ vExhaust ] = componentid;
  626. if( VehicleInfo[ vehicleid ][ vExhaust ] != -1 ) AddVehicleComponent( vehicleid, componentid );
  627. }
  628. else if( GetVehicleComponentType( componentid ) == CARMODTYPE_WHEELS ) {
  629. VehicleInfo[ vehicleid ][ vWheels ] = componentid;
  630. if( VehicleInfo[ vehicleid ][ vWheels ] != -1 ) AddVehicleComponent( vehicleid, componentid );
  631. }
  632. else if( GetVehicleComponentType( componentid ) == CARMODTYPE_STEREO ) {
  633. VehicleInfo[ vehicleid ][ vStereo ] = componentid;
  634. if( VehicleInfo[ vehicleid ][ vStereo ] != -1 ) AddVehicleComponent( vehicleid, componentid );
  635. }
  636. else if( GetVehicleComponentType( componentid ) == CARMODTYPE_HYDRAULICS ) {
  637. VehicleInfo[ vehicleid ][ vHydraulics ] = componentid;
  638. if( VehicleInfo[ vehicleid ][ vHydraulics ] != -1 ) AddVehicleComponent( vehicleid, componentid );
  639. }
  640. else if( GetVehicleComponentType( componentid ) == CARMODTYPE_FRONT_BUMPER ) {
  641. VehicleInfo[ vehicleid ][ vFrontBumper ] = componentid;
  642. if( VehicleInfo[ vehicleid ][ vFrontBumper ] != -1 ) AddVehicleComponent( vehicleid, componentid );
  643. }
  644. else if( GetVehicleComponentType( componentid ) == CARMODTYPE_REAR_BUMPER ) {
  645. VehicleInfo[ vehicleid ][ vRearBumper ] = componentid;
  646. if( VehicleInfo[ vehicleid ][ vRearBumper ] != -1 ) AddVehicleComponent( vehicleid, componentid );
  647. }
  648. else if( GetVehicleComponentType( componentid ) == CARMODTYPE_VENT_RIGHT ) {
  649. VehicleInfo[ vehicleid ][ vRightVent ] = componentid;
  650. if( VehicleInfo[ vehicleid ][ vRightVent ] != -1 ) AddVehicleComponent( vehicleid, componentid );
  651. }
  652. else if( GetVehicleComponentType( componentid ) == CARMODTYPE_VENT_LEFT ) {
  653. VehicleInfo[ vehicleid ][ vLeftVent ] = componentid;
  654. if( VehicleInfo[ vehicleid ][ vLeftVent ] != -1 ) AddVehicleComponent( vehicleid, componentid );
  655. }
  656. }
  657. }
  658. //==============================================================================
  659. stock NextIDGarage(const len) {
  660. new id = (-1);
  661. for( new loop = ( 0 ), provjera = ( -1 ), Data_[ 64 ] = "\0"; loop != len; ++ loop ) {
  662. provjera = ( loop+1 );
  663. format( Data_, ( sizeof Data_ ), TG_FILE, provjera );
  664. if(!fexist(Data_)) {
  665. id = ( provjera );
  666. break; } }
  667. return ( id );
  668. }
  669. //==============================================================================
  670. stock IsComponentidCompatible( modelid, componentid ) {
  671. if( componentid == 1025 || componentid == 1073 || componentid == 1074 || componentid == 1075 || componentid == 1076 ||
  672. componentid == 1077 || componentid == 1078 || componentid == 1079 || componentid == 1080 || componentid == 1081 ||
  673. componentid == 1082 || componentid == 1083 || componentid == 1084 || componentid == 1085 || componentid == 1096 ||
  674. componentid == 1097 || componentid == 1098 || componentid == 1087 || componentid == 1086 ) {
  675. return componentid;
  676. }
  677.  
  678. switch( modelid ) {
  679. case 400: if( componentid == 1020 || componentid == 1021 || componentid == 1019 || componentid == 1018 || componentid == 1013 || componentid == 1024 || componentid == 1008 || componentid == 1009 || componentid == 1010 ) return componentid;
  680. case 401: if( componentid == 1005 || componentid == 1004 || componentid == 1142 || componentid == 1143 || componentid == 1144 || componentid == 114 || componentid == 1020 || componentid == 1019 || componentid == 1013 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1001 || componentid == 1003 || componentid == 1017 || componentid == 1007) return componentid;
  681. case 402: if( componentid == 1009 || componentid == 1009 || componentid == 1010 ) return componentid;
  682. case 404: if( componentid == 1020 || componentid == 1021 || componentid == 1019 || componentid == 1013 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1002 || componentid == 1016 || componentid == 1000 || componentid == 1017 || componentid == 1007) return componentid;
  683. case 405: if( componentid == 1020 || componentid == 1021 || componentid == 1019 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1001 || componentid == 1014 || componentid == 1023 || componentid == 1000) return componentid;
  684. case 409: if( componentid == 1009 ) return componentid;
  685. case 410: if( componentid == 1019 || componentid == 1021 || componentid == 1020 || componentid == 1013 || componentid == 1024 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1001 || componentid == 1023 || componentid == 1003 || componentid == 1017 || componentid == 1007) return componentid;
  686. case 411: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  687. case 412: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  688. case 415: if( componentid == 1019 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1001 || componentid == 1023 || componentid == 1003 || componentid == 1017 || componentid == 1007) return componentid;
  689. case 418: if( componentid == 1020 || componentid == 1021 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1002 || componentid == 1016) return componentid;
  690. case 419: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  691. case 420: if( componentid == 1005 || componentid == 1004 || componentid == 1021 || componentid == 1019 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1001 || componentid == 1003) return componentid;
  692. case 421: if( componentid == 1020 || componentid == 1021 || componentid == 1019 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1014 || componentid == 1023 || componentid == 1016 || componentid == 1000) return componentid;
  693. case 422: if( componentid == 1020 || componentid == 1021 || componentid == 1019 || componentid == 1013 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1017 || componentid == 1007) return componentid;
  694. case 426: if( componentid == 1005 || componentid == 1004 || componentid == 1021 || componentid == 1019 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1001 || componentid == 1003) return componentid;
  695. case 429: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  696. case 436: if( componentid == 1020 || componentid == 1021 || componentid == 1022 || componentid == 1019 || componentid == 1013 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1001 || componentid == 1003 || componentid == 1017 || componentid == 1007) return componentid;
  697. case 438: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  698. case 439: if( componentid == 1003 || componentid == 1023 || componentid == 1001 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1017 || componentid == 1007 || componentid == 1142 || componentid == 1143 || componentid == 1144 || componentid == 1145 || componentid == 1013) return componentid;
  699. case 442: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  700. case 445: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  701. case 451: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  702. case 458: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  703. case 466: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  704. case 467: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  705. case 474: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  706. case 475: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  707. case 477: if( componentid == 1020 || componentid == 1021 || componentid == 1019 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1017 || componentid == 1007) return componentid;
  708. case 478: if( componentid == 1005 || componentid == 1004 || componentid == 1012 || componentid == 1020 || componentid == 1021 || componentid == 1022 || componentid == 1013 || componentid == 1024 || componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  709. case 479: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  710. case 480: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  711. case 489: if( componentid == 1005 || componentid == 1004 || componentid == 1020 || componentid == 1019 || componentid == 1018 || componentid == 1013 || componentid == 1024 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1002 || componentid == 1016 || componentid == 1000) return componentid;
  712. case 491: if( componentid == 1142 || componentid == 1143 || componentid == 1144 || componentid == 1145 || componentid == 1020 || componentid == 1021 || componentid == 1019 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1014 || componentid == 1023 || componentid == 1003 || componentid == 1017 || componentid == 1007) return componentid;
  713. case 492: if( componentid == 1005 || componentid == 1004 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1016 || componentid == 1000) return componentid;
  714. case 496: if( componentid == 1006 || componentid == 1017 || componentid == 1007 || componentid == 1011 || componentid == 1019 || componentid == 1023 || componentid == 1001 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1003 || componentid == 1002 || componentid == 1142 || componentid == 1143 || componentid == 1020) return componentid;
  715. case 500: if( componentid == 1020 || componentid == 1021 || componentid == 1019 || componentid == 1013 || componentid == 1024 || componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  716. case 506: if( componentid == 1009) return componentid;
  717. case 507: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  718. case 516: if( componentid == 1004 || componentid == 1020 || componentid == 1021 || componentid == 1019 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1002 || componentid == 1015 || componentid == 1016 || componentid == 1000 || componentid == 1017 || componentid == 1007) return componentid;
  719. case 517: if( componentid == 1142 || componentid == 1143 || componentid == 1144 || componentid == 1145 || componentid == 1020 || componentid == 1019 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1002 || componentid == 1023 || componentid == 1016 || componentid == 1003 || componentid == 1017 || componentid == 1007) return componentid;
  720. case 518: if( componentid == 1005 || componentid == 1142 || componentid == 1143 || componentid == 1144 || componentid == 1145 || componentid == 1020 || componentid == 1018 || componentid == 1013 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1001 || componentid == 1023 || componentid == 1003 || componentid == 1017 || componentid == 1007) return componentid;
  721. case 526: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  722. case 527: if( componentid == 1021 || componentid == 1020 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1001 || componentid == 1014 || componentid == 1015 || componentid == 1017 || componentid == 1007) return componentid;
  723. case 529: if( componentid == 1012 || componentid == 1011 || componentid == 1020 || componentid == 1019 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1001 || componentid == 1023 || componentid == 1003 || componentid == 1017 || componentid == 1007) return componentid;
  724. case 533: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  725. case 534: if( componentid == 1126 || componentid == 1127 || componentid == 1179 || componentid == 1185 || componentid == 1100 || componentid == 1123 || componentid == 1125 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1180 || componentid == 1178 || componentid == 1101 || componentid == 1122 || componentid == 1124 || componentid == 1106) return componentid;
  726. case 535: if( componentid == 1109 || componentid == 1110 || componentid == 1113 || componentid == 1114 || componentid == 1115 || componentid == 1116 || componentid == 1117 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1120 || componentid == 1118 || componentid == 1121 || componentid == 1119) return componentid;
  727. case 536: if( componentid == 1104 || componentid == 1105 || componentid == 1182 || componentid == 1181 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1184 || componentid == 1183 || componentid == 1128 || componentid == 1103 || componentid == 1107 || componentid == 1108) return componentid;
  728. case 540: if( componentid == 1004 || componentid == 1142 || componentid == 1143 || componentid == 1144 || componentid == 1145 || componentid == 1020 || componentid == 1019 || componentid == 1018 || componentid == 1024 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1001 || componentid == 1023 || componentid == 1017 || componentid == 1007) return componentid;
  729. case 541: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  730. case 542: if( componentid == 1144 || componentid == 1145 || componentid == 1020 || componentid == 1021 || componentid == 1019 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1014 || componentid == 1015) return componentid;
  731. case 545: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  732. case 546: if( componentid == 1004 || componentid == 1142 || componentid == 1143 || componentid == 1144 || componentid == 1145 || componentid == 1019 || componentid == 1018 || componentid == 1024 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1002 || componentid == 1001 || componentid == 1023 || componentid == 1017 || componentid == 1007) return componentid;
  733. case 547: if( componentid == 1142 || componentid == 1143 || componentid == 1020 || componentid == 1021 || componentid == 1019 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1016 || componentid == 1003 || componentid == 1000) return componentid;
  734. case 549: if( componentid == 1012 || componentid == 1011 || componentid == 1142 || componentid == 1143 || componentid == 1144 || componentid == 1145 || componentid == 1020 || componentid == 1019 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1001 || componentid == 1023 || componentid == 1003 || componentid == 1017 || componentid == 1007) return componentid;
  735. case 550: if( componentid == 1005 || componentid == 1004 || componentid == 1142 || componentid == 1143 || componentid == 1144 || componentid == 1145 || componentid == 1020 || componentid == 1019 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1001 || componentid == 1023 || componentid == 1003) return componentid;
  736. case 551: if( componentid == 1005 || componentid == 1020 || componentid == 1021 || componentid == 1019 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1002 || componentid == 1023 || componentid == 1016 || componentid == 1003) return componentid;
  737. case 555: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  738. case 558: if( componentid == 1092 || componentid == 1089 || componentid == 1166 || componentid == 1165 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1168 || componentid == 1167 || componentid == 1088 || componentid == 1091 || componentid == 1164 || componentid == 1163 || componentid == 1094 || componentid == 1090 || componentid == 1095 || componentid == 1093) return componentid;
  739. case 559: if( componentid == 1065 || componentid == 1066 || componentid == 1160 || componentid == 1173 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1159 || componentid == 1161 || componentid == 1162 || componentid == 1158 || componentid == 1067 || componentid == 1068 || componentid == 1071 || componentid == 1069 || componentid == 1072 || componentid == 1070 || componentid == 1009) return componentid;
  740. case 560: if( componentid == 1028 || componentid == 1029 || componentid == 1169 || componentid == 1170 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1141 || componentid == 1140 || componentid == 1032 || componentid == 1033 || componentid == 1138 || componentid == 1139 || componentid == 1027 || componentid == 1026 || componentid == 1030 || componentid == 1031) return componentid;
  741. case 561: if( componentid == 1064 || componentid == 1059 || componentid == 1155 || componentid == 1157 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1154 || componentid == 1156 || componentid == 1055 || componentid == 1061 || componentid == 1058 || componentid == 1060 || componentid == 1062 || componentid == 1056 || componentid == 1063 || componentid == 1057) return componentid;
  742. case 562: if( componentid == 1034 || componentid == 1037 || componentid == 1171 || componentid == 1172 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1149 || componentid == 1148 || componentid == 1038 || componentid == 1035 || componentid == 1147 || componentid == 1146 || componentid == 1040 || componentid == 1036 || componentid == 1041 || componentid == 1039) return componentid;
  743. case 565: if( componentid == 1046 || componentid == 1045 || componentid == 1153 || componentid == 1152 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1150 || componentid == 1151 || componentid == 1054 || componentid == 1053 || componentid == 1049 || componentid == 1050 || componentid == 1051 || componentid == 1047 || componentid == 1052 || componentid == 1048) return componentid;
  744. case 566: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  745. case 567: if( componentid == 1129 || componentid == 1132 || componentid == 1189 || componentid == 1188 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1187 || componentid == 1186 || componentid == 1130 || componentid == 1131 || componentid == 1102 || componentid == 1133) return componentid;
  746. case 575: if( componentid == 1044 || componentid == 1043 || componentid == 1174 || componentid == 1175 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1176 || componentid == 1177 || componentid == 1099 || componentid == 1042) return componentid;
  747. case 576: if( componentid == 1136 || componentid == 1135 || componentid == 1191 || componentid == 1190 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1192 || componentid == 1193 || componentid == 1137 || componentid == 1134) return componentid;
  748. case 579: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  749. case 580: if( componentid == 1020 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1001 || componentid == 1023 || componentid == 1017 || componentid == 1007) return componentid;
  750. case 585: if( componentid == 1142 || componentid == 1143 || componentid == 1144 || componentid == 1145 || componentid == 1020 || componentid == 1019 || componentid == 1018 || componentid == 1013 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1001 || componentid == 1023 || componentid == 1003 || componentid == 1017 || componentid == 1007) return componentid;
  751. case 587: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  752. case 589: if( componentid == 1005 || componentid == 1004 || componentid == 1144 || componentid == 1145 || componentid == 1020 || componentid == 1018 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1024 || componentid == 1013 || componentid == 1006 || componentid == 1016 || componentid == 1000 || componentid == 1017 || componentid == 1007) return componentid;
  753. case 600: if( componentid == 1005 || componentid == 1004 || componentid == 1020 || componentid == 1022 || componentid == 1018 || componentid == 1013 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1017 || componentid == 1007) return componentid;
  754. case 602: if( componentid == 1008 || componentid == 1009 || componentid == 1010) return componentid;
  755. case 603: if( componentid == 1144 || componentid == 1145 || componentid == 1142 || componentid == 1143 || componentid == 1020 || componentid == 1019 || componentid == 1018 || componentid == 1024 || componentid == 1008 || componentid == 1009 || componentid == 1010 || componentid == 1006 || componentid == 1001 || componentid == 1023 || componentid == 1017 || componentid == 1007) return componentid;
  756. }
  757. return false;
  758. }
  759. //==============================================================================
  760. stock GetVehicleCameraPos( vehicleid, &Float:x, &Float:y, &Float:z, Float:xoff=0.0, Float:yoff=0.0, Float:zoff=0.0 ) { // credits Pasha
  761. new Float:rot;
  762. GetVehicleZAngle( vehicleid, rot );
  763. rot = 360 - rot;
  764. GetVehiclePos( vehicleid, x, y, z );
  765. x = floatsin( rot, degrees ) * yoff + floatcos( rot, degrees ) * xoff + x;
  766. y = floatcos( rot, degrees ) * yoff - floatsin( rot, degrees ) * xoff + y;
  767. z = zoff + z;
  768. }
  769. //==============================================================================
  770. stock TuningTDControl( playerid, bool:show ) {
  771. if( show == true ) {
  772. for( new i = 0; i < 14; i ++ ) {
  773. PlayerTextDrawShow( playerid, TuningBuy[ playerid ][ i ] );
  774. }
  775.  
  776. }
  777. else if( show == false ) {
  778. for( new i = 0; i < 14; i ++ ) {
  779. PlayerTextDrawHide( playerid, TuningBuy[ playerid ][ i ]);
  780. }
  781. }
  782. }
  783. //==============================================================================
  784. ResetTuningInfo( playerid ) {
  785. TPInfo[ playerid ][ tID ] = -1;
  786. TPInfo[ playerid ][ tType ] = -1;
  787. TPInfo[ playerid ][ tPaintjob ] = false;
  788. TPInfo[ playerid ][ PJColor ] = -1;
  789. TPInfo[ playerid ][ PJColor ] = -1;
  790. }
  791. //==============================================================================
  792. stock ResetTuning( vehid ) {
  793. if( VehicleInfo[ vehid ][ vTuned ] ) {
  794. VehicleInfo[ vehid ][ vTuned ] = false;
  795. VehicleInfo[ vehid ][ vSpoiler ] = -1;
  796. VehicleInfo[ vehid ][ vHood ] = -1;
  797. VehicleInfo[ vehid ][ vRoof ] = -1;
  798. VehicleInfo[ vehid ][ vSkirt ] = -1;
  799. VehicleInfo[ vehid ][ vLamps ] = -1;
  800. VehicleInfo[ vehid ][ vNitro ] = -1;
  801. VehicleInfo[ vehid ][ vExhaust ] = -1;
  802. VehicleInfo[ vehid ][ vWheels ] = -1;
  803. VehicleInfo[ vehid ][ vStereo ] = -1;
  804. VehicleInfo[ vehid ][ vHydraulics ] = -1;
  805. VehicleInfo[ vehid ][ vFrontBumper ] = -1;
  806. VehicleInfo[ vehid ][ vRearBumper ] = -1;
  807. VehicleInfo[ vehid ][ vRightVent ] = -1;
  808. VehicleInfo[ vehid ][ vLeftVent ] = -1;
  809. VehicleInfo[ vehid ][ vPaintJob ] = 255;
  810. }
  811. }
  812. //==============================================================================
  813. stock GetName( id ) {
  814. new ime[MAX_PLAYER_NAME];
  815. GetPlayerName(id, ime, sizeof ime);
  816. return ime;
  817. }
  818. //==============================================================================
  819. public OnFilterScriptInit( ) {
  820. print("\n--------------------------------------");
  821. print(" Advanced Tuning System by Dimi");
  822. print("--------------------------------------\n");
  823.  
  824. for(new i = 1; i < MAX_GARAGES; i++) {
  825. new file[ 50 ];
  826. format( file, sizeof( file ), TG_FILE, i );
  827. if( fexist( file ) ) {
  828. INI_ParseFile( file, "LoadTGarage", .bExtra = true, .extra = i );
  829. tGarage[ i ][ tg3D ] = Create3DTextLabel( "{FFFFFF}To tune your vehicle type\n{ff6600}[ /tune ]", -1, tGarage[ i ][ Position ][ 0 ], tGarage[ i ][ Position ][ 1 ], tGarage[ i ][ Position ][ 2 ], 15.0, 0, 1 );
  830. tGarage[ i ][ tgPickup ] = CreatePickup( 1239, 1, tGarage[ i ][ Position ][ 0 ], tGarage[ i ][ Position ][ 1 ], tGarage[ i ][ Position ][ 2 ], -1 );
  831. }
  832. }
  833.  
  834. for( new i = 0; i < MAX_VEHICLES; i++ ) {
  835. VehicleInfo[ i ][ vTuned ] = false;
  836. VehicleInfo[ i ][ vSpoiler ] = -1;
  837. VehicleInfo[ i ][ vHood ] = -1;
  838. VehicleInfo[ i ][ vRoof ] = -1;
  839. VehicleInfo[ i ][ vSkirt ] = -1;
  840. VehicleInfo[ i ][ vLamps ] = -1;
  841. VehicleInfo[ i ][ vNitro ] = -1;
  842. VehicleInfo[ i ][ vExhaust ] = -1;
  843. VehicleInfo[ i ][ vWheels ] = -1;
  844. VehicleInfo[ i ][ vStereo ] = -1;
  845. VehicleInfo[ i ][ vHydraulics ] = -1;
  846. VehicleInfo[ i ][ vFrontBumper ] = -1;
  847. VehicleInfo[ i ][ vRearBumper ] = -1;
  848. VehicleInfo[ i ][ vRightVent ] = -1;
  849. VehicleInfo[ i ][ vLeftVent ] = -1;
  850. VehicleInfo[ i ][ vPaintJob ] = 255;
  851. }
  852. return 1;
  853. }
  854. //==============================================================================
  855. public OnFilterScriptExit( ) {
  856. return 1;
  857. }
  858. //==============================================================================
  859. public OnPlayerConnect( playerid ) {
  860. CreatePlayerTextDraws( playerid );
  861. ResetTuningInfo( playerid );
  862. return 1;
  863. }
  864. //==============================================================================
  865. public OnPlayerDisconnect( playerid, reason ) {
  866. return 1;
  867. }
  868. //==============================================================================
  869. public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[] ) {
  870. switch( dialogid ) {
  871. case dialog_TUNING: {
  872. if( response ) {
  873. if( !IsPlayerInAnyVehicle( playerid ) ) return SendErrorMessage( playerid, "You must be in the vehicle." );
  874. if( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendErrorMessage( playerid, "You must be in the driver's seat." );
  875. new vehicleid = GetPlayerVehicleID( playerid ), Float:Pos[ 6 ];
  876.  
  877. TPInfo[ playerid ][ tID ] = -1;
  878.  
  879. switch( listitem ) {
  880. case 0: {
  881.  
  882. for( new i = 0; i < NUMBER_TYPE_PAINTJOB; i++ ) {
  883. if( pjInfo[ i ][ vehID ] == GetVehicleModel( vehicleid ) ) {
  884. TPInfo[ playerid ][ tID ] = i;
  885. break;
  886. }
  887. }
  888. if( TPInfo[ playerid ][ tID ] == -1 ) return SendErrorMessage( playerid, "No compatible paintjobs for your vehicle model." );
  889.  
  890. new pid = TPInfo[ playerid ][ tID ];
  891. TPInfo[ playerid ][ tPaintjob ] = true;
  892.  
  893. GetVehicleColor( vehicleid, TPInfo[ playerid ][ PJColor ][ 0 ], TPInfo[ playerid ][ PJColor ][ 1 ] );
  894.  
  895. TogglePlayerControllable( playerid, false );
  896. TuningTDControl( playerid, true );
  897.  
  898. ChangeVehicleColor( vehicleid, 1, 1 );
  899. ChangeVehiclePaintjob( vehicleid, pjInfo[ pid ][ pNumber ] );
  900.  
  901. format( globalstring, sizeof( globalstring ), "%s", pjInfo[ pid ][ pName ] );
  902. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  903. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", pjInfo[ pid ][ pPrice ] );
  904. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  905.  
  906. GetVehicleCameraPos( vehicleid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], 4, 0, 5 );
  907. SetPlayerCameraPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  908.  
  909. GetVehiclePos( vehicleid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  910. SetPlayerCameraLookAt( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  911.  
  912. SelectTextDraw( playerid, COLOR_ORANGE );
  913. }
  914. case 1: {
  915. SPD( playerid, dialog_TUNING_2, DSI, D_TOP, "Input Color1 ID and Color2 ID.\nExample: 0 1", D_OK, D_CANCEL );
  916. }
  917. case 2: {
  918.  
  919. for( new i = 0; i < MAX_COMPONENTS; i++ ) {
  920. if( cInfo[ i ][ cType ] == CARMODTYPE_EXHAUST ) {
  921. if( cInfo[ i ][ cID ] == IsComponentidCompatible( GetVehicleModel( vehicleid ), cInfo[ i ][ cID ] ) ) {
  922. TPInfo[ playerid ][ tID ] = i;
  923. break;
  924. }
  925. }
  926. }
  927. if( TPInfo[ playerid ][ tID ] == -1 ) return SendErrorMessage( playerid, "No compatible components selected species for your vehicle model." );
  928.  
  929. new cid = TPInfo[ playerid ][ tID ];
  930. TPInfo[ playerid ][ tType ] = CARMODTYPE_EXHAUST;
  931. TPInfo[ playerid ][ tPaintjob ] = false;
  932.  
  933. TogglePlayerControllable( playerid, false );
  934. TuningTDControl( playerid, true );
  935.  
  936. format( globalstring, sizeof( globalstring ), "%s", cInfo[ cid ][ cName ] );
  937. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  938. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", cInfo[ cid ][ cPrice ] );
  939. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  940.  
  941. AddVehicleComponent( vehicleid, cInfo[ cid ][ cID ] );
  942.  
  943. GetVehicleCameraPos( vehicleid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], -2, -5, 0 );
  944. SetPlayerCameraPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  945.  
  946. GetVehiclePos( vehicleid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  947. SetPlayerCameraLookAt( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  948.  
  949. SelectTextDraw( playerid, COLOR_ORANGE );
  950. }
  951. case 3: {
  952.  
  953. for( new i = 0; i < MAX_COMPONENTS; i++ ) {
  954. if( cInfo[ i ][ cType ] == CARMODTYPE_FRONT_BUMPER ) {
  955. if( cInfo[ i ][ cID ] == IsComponentidCompatible( GetVehicleModel( vehicleid ), cInfo[ i ][ cID ] ) ) {
  956. TPInfo[ playerid ][ tID ] = i;
  957. break;
  958. }
  959. }
  960. }
  961. if( TPInfo[ playerid ][ tID ] == -1 ) return SendErrorMessage( playerid, "No compatible components selected species for your vehicle model." );
  962.  
  963. new cid = TPInfo[ playerid ][ tID ];
  964. TPInfo[ playerid ][ tType ] = CARMODTYPE_FRONT_BUMPER;
  965. TPInfo[ playerid ][ tPaintjob ] = false;
  966.  
  967. TogglePlayerControllable( playerid, false );
  968. TuningTDControl( playerid, true );
  969.  
  970. format( globalstring, sizeof( globalstring ), "%s", cInfo[ cid ][ cName ] );
  971. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  972. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", cInfo[ cid ][ cPrice ] );
  973. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  974.  
  975. AddVehicleComponent( vehicleid, cInfo[ cid ][ cID ] );
  976.  
  977. GetVehicleCameraPos( vehicleid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], 0, 6, 0.5 ); // done
  978. SetPlayerCameraPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  979.  
  980. GetVehiclePos( vehicleid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  981. SetPlayerCameraLookAt( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  982.  
  983. SelectTextDraw( playerid, COLOR_ORANGE );
  984. }
  985. case 4: {
  986.  
  987. for( new i = 0; i < MAX_COMPONENTS; i++ ) {
  988. if( cInfo[ i ][ cType ] == CARMODTYPE_REAR_BUMPER ) {
  989. if( cInfo[ i ][ cID ] == IsComponentidCompatible( GetVehicleModel( vehicleid ), cInfo[ i ][ cID ] ) ) {
  990. TPInfo[ playerid ][ tID ] = i;
  991. break;
  992. }
  993. }
  994. }
  995. if( TPInfo[ playerid ][ tID ] == -1 ) return SendErrorMessage( playerid, "No compatible components selected species for your vehicle model." );
  996.  
  997. new cid = TPInfo[ playerid ][ tID ];
  998. TPInfo[ playerid ][ tType ] = CARMODTYPE_REAR_BUMPER;
  999. TPInfo[ playerid ][ tPaintjob ] = false;
  1000.  
  1001. TogglePlayerControllable( playerid, false );
  1002. TuningTDControl( playerid, true );
  1003.  
  1004. format( globalstring, sizeof( globalstring ), "%s", cInfo[ cid ][ cName ] );
  1005. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  1006. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", cInfo[ cid ][ cPrice ] );
  1007. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  1008.  
  1009. AddVehicleComponent( vehicleid, cInfo[ cid ][ cID ] );
  1010.  
  1011. GetVehicleCameraPos( vehicleid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], 0, -6, 0.5 ); // done
  1012. SetPlayerCameraPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  1013.  
  1014. GetVehiclePos( vehicleid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1015. SetPlayerCameraLookAt( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1016.  
  1017. SelectTextDraw( playerid, COLOR_ORANGE );
  1018. }
  1019. case 5: {
  1020.  
  1021. for( new i = 0; i < MAX_COMPONENTS; i++ ) {
  1022. if( cInfo[ i ][ cType ] == CARMODTYPE_ROOF ) {
  1023. if( cInfo[ i ][ cID ] == IsComponentidCompatible( GetVehicleModel( vehicleid ), cInfo[ i ][ cID ] ) ) {
  1024. TPInfo[ playerid ][ tID ] = i;
  1025. break;
  1026. }
  1027. }
  1028. }
  1029. if( TPInfo[ playerid ][ tID ] == -1 ) return SendErrorMessage( playerid, "No compatible components selected species for your vehicle model." );
  1030.  
  1031. new cid = TPInfo[ playerid ][ tID ];
  1032. TPInfo[ playerid ][ tType ] = CARMODTYPE_ROOF;
  1033. TPInfo[ playerid ][ tPaintjob ] = false;
  1034.  
  1035. TogglePlayerControllable( playerid, false );
  1036. TuningTDControl( playerid, true );
  1037.  
  1038. format( globalstring, sizeof( globalstring ), "%s", cInfo[ cid ][ cName ] );
  1039. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  1040. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", cInfo[ cid ][ cPrice ] );
  1041. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  1042.  
  1043. AddVehicleComponent( vehicleid, cInfo[ cid ][ cID ] );
  1044.  
  1045. GetVehicleCameraPos( vehicleid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], 0, 6, 2 ); // done
  1046. SetPlayerCameraPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  1047.  
  1048. GetVehiclePos( vehicleid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1049. SetPlayerCameraLookAt( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1050.  
  1051. SelectTextDraw( playerid, COLOR_ORANGE );
  1052. }
  1053. case 6: {
  1054.  
  1055. for( new i = 0; i < MAX_COMPONENTS; i++ ) {
  1056. if( cInfo[ i ][ cType ] == CARMODTYPE_SPOILER ) {
  1057. if( cInfo[ i ][ cID ] == IsComponentidCompatible( GetVehicleModel( vehicleid ), cInfo[ i ][ cID ] ) ) {
  1058. TPInfo[ playerid ][ tID ] = i;
  1059. break;
  1060. }
  1061. }
  1062. }
  1063. if( TPInfo[ playerid ][ tID ] == -1 ) return SendErrorMessage( playerid, "No compatible components selected species for your vehicle model." );
  1064.  
  1065. new cid = TPInfo[ playerid ][ tID ];
  1066. TPInfo[ playerid ][ tType ] = CARMODTYPE_SPOILER;
  1067. TPInfo[ playerid ][ tPaintjob ] = false;
  1068.  
  1069. TogglePlayerControllable( playerid, false );
  1070. TuningTDControl( playerid, true );
  1071.  
  1072. format( globalstring, sizeof( globalstring ), "%s", cInfo[ cid ][ cName ] );
  1073. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  1074. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", cInfo[ cid ][ cPrice ] );
  1075. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  1076.  
  1077. AddVehicleComponent( vehicleid, cInfo[ cid ][ cID ] );
  1078.  
  1079. GetVehicleCameraPos( vehicleid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], 0, -6, 2 ); // done
  1080. SetPlayerCameraPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  1081.  
  1082. GetVehiclePos( vehicleid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1083. SetPlayerCameraLookAt( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1084.  
  1085. SelectTextDraw( playerid, COLOR_ORANGE );
  1086. }
  1087. case 7: {
  1088.  
  1089. for( new i = 0; i < MAX_COMPONENTS; i++ ) {
  1090. if( cInfo[ i ][ cType ] == CARMODTYPE_SIDESKIRT ) {
  1091. if( cInfo[ i ][ cID ] == IsComponentidCompatible( GetVehicleModel( vehicleid ), cInfo[ i ][ cID ] ) ) {
  1092. TPInfo[ playerid ][ tID ] = i;
  1093. break;
  1094. }
  1095. }
  1096. }
  1097. if( TPInfo[ playerid ][ tID ] == -1 ) return SendErrorMessage( playerid, "No compatible components selected species for your vehicle model." );
  1098.  
  1099. new cid = TPInfo[ playerid ][ tID ];
  1100. TPInfo[ playerid ][ tType ] = CARMODTYPE_SIDESKIRT;
  1101. TPInfo[ playerid ][ tPaintjob ] = false;
  1102.  
  1103. TogglePlayerControllable( playerid, false );
  1104. TuningTDControl( playerid, true );
  1105.  
  1106. format( globalstring, sizeof( globalstring ), "%s", cInfo[ cid ][ cName ] );
  1107. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  1108. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", cInfo[ cid ][ cPrice ] );
  1109. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  1110.  
  1111. AddVehicleComponent( vehicleid, cInfo[ cid ][ cID ] );
  1112.  
  1113. GetVehicleCameraPos( vehicleid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], 4, 0, 0.5 );
  1114. SetPlayerCameraPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  1115.  
  1116. GetVehiclePos( vehicleid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1117. SetPlayerCameraLookAt( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1118.  
  1119. SelectTextDraw( playerid, COLOR_ORANGE );
  1120. }
  1121. case 8: {
  1122.  
  1123. for( new i = 0; i < MAX_COMPONENTS; i++ ) {
  1124. if( cInfo[ i ][ cType ] == CARMODTYPE_WHEELS ) {
  1125. if( cInfo[ i ][ cID ] == IsComponentidCompatible( GetVehicleModel( vehicleid ), cInfo[ i ][ cID ] ) ) {
  1126. TPInfo[ playerid ][ tID ] = i;
  1127. break;
  1128. }
  1129. }
  1130. }
  1131. if( TPInfo[ playerid ][ tID ] == -1 ) return SendErrorMessage( playerid, "No compatible components selected species for your vehicle model." );
  1132.  
  1133. new cid = TPInfo[ playerid ][ tID ];
  1134. TPInfo[ playerid ][ tType ] = CARMODTYPE_WHEELS;
  1135. TPInfo[ playerid ][ tPaintjob ] = false;
  1136.  
  1137. TogglePlayerControllable( playerid, false );
  1138. TuningTDControl( playerid, true );
  1139.  
  1140. format( globalstring, sizeof( globalstring ), "%s", cInfo[ cid ][ cName ] );
  1141. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  1142. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", cInfo[ cid ][ cPrice ] );
  1143. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  1144.  
  1145. AddVehicleComponent( vehicleid, cInfo[ cid ][ cID ] );
  1146.  
  1147. GetVehicleCameraPos( vehicleid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], 4, 0, 0.5 ); // done
  1148. SetPlayerCameraPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  1149.  
  1150. GetVehiclePos( vehicleid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1151. SetPlayerCameraLookAt( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1152.  
  1153. SelectTextDraw( playerid, COLOR_ORANGE );
  1154. }
  1155. case 9: {
  1156.  
  1157. for( new i = 0; i < MAX_COMPONENTS; i++ ) {
  1158. if( cInfo[ i ][ cType ] == CARMODTYPE_STEREO ) {
  1159. if( cInfo[ i ][ cID ] == IsComponentidCompatible( GetVehicleModel( vehicleid ), cInfo[ i ][ cID ] ) ) {
  1160. TPInfo[ playerid ][ tID ] = i;
  1161. break;
  1162. }
  1163. }
  1164. }
  1165. if( TPInfo[ playerid ][ tID ] == -1 ) return SendErrorMessage( playerid, "No compatible components selected species for your vehicle model." );
  1166.  
  1167. new cid = TPInfo[ playerid ][ tID ];
  1168. TPInfo[ playerid ][ tType ] = CARMODTYPE_STEREO;
  1169. TPInfo[ playerid ][ tPaintjob ] = false;
  1170.  
  1171. TogglePlayerControllable( playerid, false );
  1172. TuningTDControl( playerid, true );
  1173.  
  1174. format( globalstring, sizeof( globalstring ), "%s", cInfo[ cid ][ cName ] );
  1175. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  1176. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", cInfo[ cid ][ cPrice ] );
  1177. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  1178.  
  1179. AddVehicleComponent( vehicleid, cInfo[ cid ][ cID ] );
  1180.  
  1181. GetVehicleCameraPos( vehicleid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], 0, -6, 2 );
  1182. SetPlayerCameraPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  1183.  
  1184. GetVehiclePos( vehicleid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1185. SetPlayerCameraLookAt( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1186.  
  1187. SelectTextDraw( playerid, COLOR_ORANGE );
  1188. }
  1189. case 10: {
  1190.  
  1191. for( new i = 0; i < MAX_COMPONENTS; i++ ) {
  1192. if( cInfo[ i ][ cType ] == CARMODTYPE_HYDRAULICS ) {
  1193. if( cInfo[ i ][ cID ] == IsComponentidCompatible( GetVehicleModel( vehicleid ), cInfo[ i ][ cID ] ) ) {
  1194. TPInfo[ playerid ][ tID ] = i;
  1195. break;
  1196. }
  1197. }
  1198. }
  1199. if( TPInfo[ playerid ][ tID ] == -1 ) return SendErrorMessage( playerid, "No compatible components selected species for your vehicle model." );
  1200.  
  1201. new cid = TPInfo[ playerid ][ tID ];
  1202. TPInfo[ playerid ][ tType ] = CARMODTYPE_HYDRAULICS;
  1203. TPInfo[ playerid ][ tPaintjob ] = false;
  1204.  
  1205. TogglePlayerControllable( playerid, false );
  1206. TuningTDControl( playerid, true );
  1207.  
  1208. format( globalstring, sizeof( globalstring ), "%s", cInfo[ cid ][ cName ] );
  1209. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  1210. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", cInfo[ cid ][ cPrice ] );
  1211. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  1212.  
  1213. AddVehicleComponent( vehicleid, cInfo[ cid ][ cID ] );
  1214.  
  1215. GetVehicleCameraPos( vehicleid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], 2, 2, 2 );
  1216. SetPlayerCameraPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  1217.  
  1218. GetVehiclePos( vehicleid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1219. SetPlayerCameraLookAt( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1220.  
  1221. SelectTextDraw( playerid, COLOR_ORANGE );
  1222. }
  1223. case 11: {
  1224.  
  1225. for( new i = 0; i < MAX_COMPONENTS; i++ ) {
  1226. if( cInfo[ i ][ cType ] == CARMODTYPE_NITRO ) {
  1227. if( cInfo[ i ][ cID ] == IsComponentidCompatible( GetVehicleModel( vehicleid ), cInfo[ i ][ cID ] ) ) {
  1228. TPInfo[ playerid ][ tID ] = i;
  1229. break;
  1230. }
  1231. }
  1232. }
  1233. if( TPInfo[ playerid ][ tID ] == -1 ) return SendErrorMessage( playerid, "No compatible components selected species for your vehicle model." );
  1234.  
  1235. new cid = TPInfo[ playerid ][ tID ];
  1236. TPInfo[ playerid ][ tType ] = CARMODTYPE_NITRO;
  1237. TPInfo[ playerid ][ tPaintjob ] = false;
  1238.  
  1239. TogglePlayerControllable( playerid, false );
  1240. TuningTDControl( playerid, true );
  1241.  
  1242. format( globalstring, sizeof( globalstring ), "%s", cInfo[ cid ][ cName ] );
  1243. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  1244. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", cInfo[ cid ][ cPrice ] );
  1245. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  1246.  
  1247. AddVehicleComponent( vehicleid, cInfo[ cid ][ cID ] );
  1248.  
  1249. GetVehicleCameraPos( vehicleid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], 0, -6, 2 ); // done
  1250. SetPlayerCameraPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  1251.  
  1252. GetVehiclePos( vehicleid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1253. SetPlayerCameraLookAt( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1254.  
  1255. SelectTextDraw( playerid, COLOR_ORANGE );
  1256. }
  1257. }
  1258. }
  1259. else if( !response ) {
  1260. SetCameraBehindPlayer( playerid );
  1261. }
  1262. }
  1263. case dialog_TUNING_2: {
  1264. if( !response ) return 1;
  1265. if( response ) {
  1266. if( !IsPlayerInAnyVehicle( playerid ) ) return SendErrorMessage( playerid, "You must be in the vehicle." );
  1267. if( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendErrorMessage( playerid, "You must be in the driver's seat." );
  1268. new vehicleid = GetPlayerVehicleID( playerid );
  1269. if( GetPlayerMoney( playerid ) < COLOR_PRICE ) return SendErrorMessage( playerid, "You do not have enough money." );
  1270. new b1, b2;
  1271. if( sscanf( inputtext, "ii", b1, b2 ) ) return SPD( playerid, dialog_TUNING_2, DSI, D_TOP, "Input Color1 ID and Color2 ID.\nExample: 0 1", D_OK, D_CANCEL );
  1272. if( b1 < 0 || b2 < 0 || b1 > 255 || b2 > 255 ) return SendErrorMessage( playerid, "Color ID can't be higher from 255 or lower than 0!");
  1273.  
  1274. ChangeVehicleColor( vehicleid, b1, b2 );
  1275. GivePlayerMoney( playerid, COLOR_PRICE );
  1276.  
  1277. SPD( playerid, dialog_TUNING, DSL, D_TOP, D_TEXT, D_OK, D_CANCEL );
  1278. }
  1279. }
  1280. }
  1281. return true;
  1282. }
  1283. //==============================================================================
  1284. public OnVehicleSpawn( vehicleid ) {
  1285. SetTune( vehicleid );
  1286. return true;
  1287. }
  1288. //==============================================================================
  1289. public OnPlayerClickPlayerTextDraw( playerid, PlayerText:playertextid ) {
  1290. if( _:playertextid != INVALID_TEXT_DRAW ) {
  1291. if( playertextid == TuningBuy[ playerid ][ 7 ] ) { // desno
  1292. if( !IsPlayerInAnyVehicle( playerid ) ) return SendErrorMessage( playerid, "You must be in the vehicle." );
  1293. if( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendErrorMessage( playerid, "You must be in the driver's seat." );
  1294.  
  1295. if( TPInfo[ playerid ][ tPaintjob ] == false ) {
  1296.  
  1297. new compid = -1, vehicleid = GetPlayerVehicleID( playerid );
  1298.  
  1299. for( new i = ( TPInfo[ playerid ][ tID ]+1 ); i < MAX_COMPONENTS; i++ ) {
  1300. if( cInfo[ i ][ cType ] == TPInfo[ playerid ][ tType ] ) {
  1301. if( cInfo[ i ][ cID ] == IsComponentidCompatible( GetVehicleModel( vehicleid ), cInfo[ i ][ cID ] ) ) {
  1302. compid = i;
  1303. break;
  1304. }
  1305. }
  1306. }
  1307. if( compid == -1 ) return SendErrorMessage( playerid, "No compatible components selected species for your vehicle model" );
  1308.  
  1309. RemoveVehicleComponent( vehicleid, cInfo[ TPInfo[ playerid ][ tID ] ][ cID ] );
  1310.  
  1311. TPInfo[ playerid ][ tID ] = compid;
  1312.  
  1313. format( globalstring, sizeof( globalstring ), "%s", cInfo[ compid ][ cName ] );
  1314. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  1315. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", cInfo[ compid ][ cPrice ] );
  1316. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  1317.  
  1318. AddVehicleComponent( vehicleid, cInfo[ compid ][ cID ] );
  1319.  
  1320. SelectTextDraw( playerid, COLOR_ORANGE );
  1321. }
  1322. else if( TPInfo[ playerid ][ tPaintjob ] == true ) {
  1323.  
  1324. new paintid = -1, vehicleid = GetPlayerVehicleID( playerid );
  1325.  
  1326. for( new i = ( TPInfo[ playerid ][ tID ]+1 ); i < NUMBER_TYPE_PAINTJOB; i++ ) {
  1327. if( pjInfo[ i ][ vehID ] == GetVehicleModel( vehicleid ) ) {
  1328. paintid = i;
  1329. break;
  1330. }
  1331. }
  1332. if( paintid == -1 ) return SendErrorMessage( playerid, "No compatible paintjobs for your vehicle model." );
  1333.  
  1334. TPInfo[ playerid ][ tID ] = paintid;
  1335.  
  1336. format( globalstring, sizeof( globalstring ), "%s", pjInfo[ paintid ][ pName ] );
  1337. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  1338. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", pjInfo[ paintid ][ pPrice ] );
  1339. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  1340.  
  1341. ChangeVehiclePaintjob( vehicleid, pjInfo[ paintid ][ pNumber ] );
  1342.  
  1343. SelectTextDraw( playerid, COLOR_ORANGE );
  1344. }
  1345. }
  1346. if( playertextid == TuningBuy[ playerid ][ 8 ] ) { // levo
  1347. if( TPInfo[ playerid ][ tPaintjob ] == false ) {
  1348.  
  1349. if( !IsPlayerInAnyVehicle( playerid ) ) return SendErrorMessage( playerid, "You must be in the vehicle." );
  1350. if( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendErrorMessage( playerid, "You must be in the driver's seat." );
  1351.  
  1352. new compid = -1, vehicleid = GetPlayerVehicleID( playerid );
  1353.  
  1354. for( new i = (TPInfo[ playerid ][ tID ]-1); i > 0; i-- ) {
  1355. if( cInfo[ i ][ cType ] == TPInfo[ playerid ][ tType ] ) {
  1356. if( cInfo[ i ][ cID ] == IsComponentidCompatible( GetVehicleModel( vehicleid ), cInfo[ i ][ cID ] ) ) {
  1357. compid = i;
  1358. break;
  1359. }
  1360. }
  1361. }
  1362. if( compid == -1 ) return SendErrorMessage( playerid, "No compatible components selected species for your vehicle model." );
  1363.  
  1364. RemoveVehicleComponent( vehicleid, cInfo[ TPInfo[ playerid ][ tID ] ][ cID ] );
  1365.  
  1366. TPInfo[ playerid ][ tID ] = compid;
  1367.  
  1368. format( globalstring, sizeof( globalstring ), "%s", cInfo[ compid ][ cName ] );
  1369. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  1370. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", cInfo[ compid ][ cPrice ] );
  1371. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  1372.  
  1373. AddVehicleComponent( vehicleid, cInfo[ compid ][ cID ] );
  1374.  
  1375. SelectTextDraw( playerid, COLOR_ORANGE );
  1376. }
  1377. else if( TPInfo[ playerid ][ tPaintjob ] == true ) {
  1378.  
  1379. new paintid = -1, vehicleid = GetPlayerVehicleID( playerid );
  1380.  
  1381. for( new i = (TPInfo[ playerid ][ tID ]-1); i > 0; i-- ) {
  1382. if( pjInfo[ i ][ vehID ] == GetVehicleModel( vehicleid ) ) {
  1383. paintid = i;
  1384. break;
  1385. }
  1386. }
  1387. if( paintid == -1 ) return SendErrorMessage( playerid, "No compatible paintjobs for your vehicle model." );
  1388.  
  1389. TPInfo[ playerid ][ tID ] = paintid;
  1390.  
  1391. format( globalstring, sizeof( globalstring ), "%s", pjInfo[ paintid ][ pName ] );
  1392. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 3 ], globalstring );
  1393. format( globalstring, sizeof( globalstring ), "price: ~w~%d$", pjInfo[ paintid ][ pPrice ] );
  1394. PlayerTextDrawSetString( playerid, TuningBuy[ playerid ][ 4 ], globalstring );
  1395.  
  1396. ChangeVehiclePaintjob( vehicleid, pjInfo[ paintid ][ pNumber ] );
  1397.  
  1398. SelectTextDraw( playerid, COLOR_ORANGE );
  1399. }
  1400. }
  1401. if( playertextid == TuningBuy[ playerid ][ 9 ] ) { // buy
  1402. if( !IsPlayerInAnyVehicle( playerid ) ) return SendErrorMessage( playerid, "You must be in the vehicle." );
  1403. if( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendErrorMessage( playerid, "You must be in the driver's seat." );
  1404.  
  1405. new Float:Pos[ 6 ], vehicleid = GetPlayerVehicleID( playerid );
  1406.  
  1407. if( TPInfo[ playerid ][ tPaintjob ] == false ) {
  1408.  
  1409. if( GetPlayerMoney( playerid ) < cInfo[ TPInfo[ playerid ][ tID ] ][ cPrice ] ) return SendErrorMessage( playerid, "You do not have enough money." );
  1410.  
  1411. new cid = TPInfo[ playerid ][ tID ];
  1412.  
  1413. RemoveVehicleComponent( vehicleid, cInfo[ TPInfo[ playerid ][ tID ] ][ cID ] );
  1414.  
  1415. VehicleInfo[ vehicleid ][ vTuned ] = true;
  1416.  
  1417. AddComponentToVehicle( vehicleid, cInfo[ cid ][ cID ] );
  1418.  
  1419. GivePlayerMoney( playerid, -cInfo[ TPInfo[ playerid ][ tID ] ][ cPrice ] );
  1420.  
  1421. }
  1422. else if( TPInfo[ playerid ][ tPaintjob ] == true ) {
  1423.  
  1424. if( GetPlayerMoney( playerid ) < pjInfo[ TPInfo[ playerid ][ tID ] ][ pPrice ] ) return SendErrorMessage( playerid, "You do not have enough money." );
  1425.  
  1426. new paintid = TPInfo[ playerid ][ tID ];
  1427.  
  1428. VehicleInfo[ vehicleid ][ vTuned ] = true;
  1429.  
  1430. VehicleInfo[ vehicleid ][ vPaintJob ] = pjInfo[ paintid ][ pNumber ];
  1431.  
  1432. GivePlayerMoney( playerid, -pjInfo[ TPInfo[ playerid ][ tID ] ][ pPrice ] );
  1433.  
  1434. ChangeVehicleColor( vehicleid, TPInfo[ playerid ][ PJColor ][ 0 ], TPInfo[ playerid ][ PJColor ][ 1 ] );
  1435.  
  1436. ChangeVehiclePaintjob( vehicleid, pjInfo[ paintid ][ pNumber ] );
  1437.  
  1438. }
  1439. GetVehicleCameraPos( vehicleid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], 0, 6, 2 );
  1440. SetPlayerCameraPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  1441.  
  1442. GetVehiclePos( vehicleid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1443. SetPlayerCameraLookAt( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1444.  
  1445. CancelSelectTextDraw( playerid );
  1446.  
  1447. TuningTDControl( playerid, false );
  1448. TogglePlayerControllable( playerid, true );
  1449.  
  1450. SPD( playerid, dialog_TUNING, DSL, D_TOP, D_TEXT, D_OK, D_CANCEL );
  1451. }
  1452. if( playertextid == TuningBuy[ playerid ][ 13 ] ) { // close
  1453.  
  1454. if( !IsPlayerInAnyVehicle( playerid ) ) return SendErrorMessage( playerid, "You must be in the vehicle." );
  1455. if( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendErrorMessage( playerid, "You must be in the driver's seat." );
  1456.  
  1457. new Float:Pos[ 6 ], vehicleid = GetPlayerVehicleID( playerid );
  1458.  
  1459. if( TPInfo[ playerid ][ tPaintjob ] == false ) {
  1460.  
  1461. RemoveVehicleComponent( vehicleid, cInfo[ TPInfo[ playerid ][ tID ] ][ cID ] );
  1462.  
  1463. SetTune( vehicleid );
  1464. }
  1465. else if( TPInfo[ playerid ][ tPaintjob ] == true ) {
  1466. ChangeVehiclePaintjob( vehicleid, 3 );
  1467. ChangeVehicleColor( vehicleid, TPInfo[ playerid ][ PJColor ][ 0 ], TPInfo[ playerid ][ PJColor ][ 1 ] );
  1468. }
  1469. GetVehicleCameraPos( vehicleid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ], 0, 6, 2 );
  1470. SetPlayerCameraPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  1471.  
  1472. GetVehiclePos( vehicleid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1473. SetPlayerCameraLookAt( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1474.  
  1475. CancelSelectTextDraw( playerid );
  1476.  
  1477. TuningTDControl( playerid, false );
  1478. TogglePlayerControllable( playerid, true );
  1479.  
  1480. SPD( playerid, dialog_TUNING, DSL, D_TOP, D_TEXT, D_OK, D_CANCEL );
  1481. }
  1482. }
  1483. return true;
  1484. }
  1485.  
  1486. //================================[ Commands ]==================================
  1487.  
  1488. CMD:tune( playerid, params[] ) {
  1489. if( GetNearestTGarage( playerid ) == -1 ) return SendErrorMessage( playerid, "You must to be on pickup of tuning garage." );
  1490. SPD( playerid, dialog_TUNING, DSL, D_TOP, D_TEXT, D_OK, D_CANCEL );
  1491. return true;
  1492. }
  1493. //==============================================================================
  1494. CMD:removetuning( playerid, params[] ) {
  1495. if( GetNearestTGarage( playerid ) == -1 ) return SendErrorMessage( playerid, "You must to be on pickup of tuning garage." );
  1496. if( !IsPlayerInAnyVehicle( playerid ) ) return SendErrorMessage( playerid, "You must be in the vehicle." );
  1497. if( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendErrorMessage( playerid, "You must be in the driver's seat." );
  1498. new vehicleid = GetPlayerVehicleID( playerid ), componentid;
  1499.  
  1500. ResetTuning( vehicleid );
  1501.  
  1502. ChangeVehiclePaintjob( vehicleid, 3 );
  1503. for( new i; i < 14; i++ ) {
  1504. componentid = GetVehicleComponentInSlot( vehicleid, i );
  1505. if( componentid != 0 )
  1506. RemoveVehicleComponent( vehicleid, componentid );
  1507. }
  1508. SendClientMessage( playerid, -1, "Successfully removed tuning." );
  1509. return true;
  1510. }
  1511. //==============================================================================
  1512. CMD:savetuning( playerid, params[] ) {
  1513. new file[ 80 ], tuningname[ 40 ];
  1514. if( sscanf( params,"s[40]", tuningname ) ) return SendClientMessage( playerid, -1, "USAGE: /savetuning [ tuning-name ]");
  1515. if( !IsPlayerInAnyVehicle( playerid ) ) return SendErrorMessage( playerid, "You must be in the vehicle." );
  1516. if( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendErrorMessage( playerid, "You must be in the driver's seat." );
  1517. new vehicleid = GetPlayerVehicleID( playerid );
  1518. format( file, sizeof( file ), T_FILE, tuningname );
  1519. if( fexist( file ) ) return SendErrorMessage( playerid, "Already exist saved tuning with that name!");
  1520.  
  1521. format( globalstring, sizeof( globalstring ), "Successfully saved tuning with name %s", tuningname );
  1522. SendClientMessage( playerid, -1, globalstring );
  1523.  
  1524. SaveTuning( playerid, vehicleid, tuningname );
  1525. return true;
  1526. }
  1527. //==============================================================================
  1528. CMD:loadtuning( playerid, params[] ) {
  1529. new file[ 80 ], tuningname[ 40 ];
  1530. if( sscanf( params,"s[40]", tuningname ) ) return SendClientMessage( playerid, -1, "USAGE: /loadtuning [ tuning-name ]");
  1531. if( !IsPlayerInAnyVehicle( playerid ) ) return SendErrorMessage( playerid, "You must be in the vehicle." );
  1532. if( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) return SendErrorMessage( playerid, "You must be in the driver's seat." );
  1533. new vehicleid = GetPlayerVehicleID( playerid );
  1534. if( VehicleInfo[ vehicleid ][ vTuned ] == true ) return SendErrorMessage( playerid, "This vehicle is arleady tuned." );
  1535. format( file, sizeof( file ), T_FILE, tuningname );
  1536. if( !fexist( file ) ) return SendErrorMessage( playerid, "No exist saved tuning with that name!");
  1537. INI_ParseFile( file, "LoadTuning", .bExtra = true, .extra = vehicleid );
  1538. if( strcmp( GetName( playerid ), VehicleInfo[ vehicleid ][ vOwner ], true ) == 0 ) {
  1539.  
  1540. if( GetVehicleModel( vehicleid ) != VehicleInfo[ vehicleid ][ vVehID ] ) return SendErrorMessage( playerid, "This tuning is not saved for your vehicle model." );
  1541.  
  1542. format( globalstring, sizeof( globalstring ), "Successfully loaded tuning with name %s", tuningname );
  1543. SendClientMessage( playerid, -1, globalstring );
  1544.  
  1545. SetTune( vehicleid );
  1546. ChangeVehicleColor( vehicleid, VehicleInfo[ vehicleid ][ vColor1 ], VehicleInfo[ vehicleid ][ vColor2 ] );
  1547. }
  1548. else return SendErrorMessage( playerid, "You are not a owner of this tuning." );
  1549. return true;
  1550. }
  1551. //==============================================================================
  1552. CMD:maketgarage( playerid, params[] ) {
  1553. if( !IsPlayerAdmin( playerid ) ) return SendErrorMessage( playerid, "You must be rcon admin." );
  1554. new i = NextIDGarage( MAX_GARAGES ), Float:Pos[ 3 ], file[ 40 ];
  1555. GetPlayerPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
  1556. format( file, sizeof( file ), TG_FILE, i );
  1557. if( fexist( file ) ) return SendErrorMessage( playerid, "ID of that garage already exist!" );
  1558. tGarage[ i ][ Position ][ 0 ] = Pos[ 0 ];
  1559. tGarage[ i ][ Position ][ 1 ] = Pos[ 1 ];
  1560. tGarage[ i ][ Position ][ 2 ] = Pos[ 2 ];
  1561. tGarage[ i ][ tg3D ] = Create3DTextLabel( "{FFFFFF}To tune your vehicle type\n{ff6600}[ /tune ]", -1, tGarage[ i ][ Position ][ 0 ], tGarage[ i ][ Position ][ 1 ], tGarage[ i ][ Position ][ 2 ], 15.0, 0, 1 );
  1562. tGarage[ i ][ tgPickup ] = CreatePickup( 1239, 1, tGarage[ i ][ Position ][ 0 ], tGarage[ i ][ Position ][ 1 ], tGarage[ i ][ Position ][ 2 ], -1 );
  1563. SaveTGarage( i );
  1564. return true;
  1565. }
  1566. //==============================================================================
  1567. CMD:removetgarage( playerid, params[] ) {
  1568. if( !IsPlayerAdmin( playerid ) ) return SendErrorMessage( playerid, "You must be rcon admin." );
  1569. new i = GetNearestTGarage( playerid );
  1570. if( i == -1 ) return SendErrorMessage( playerid, "You must be on pickup for tune." );
  1571.  
  1572. tGarage[ i ][ Position ][ 0 ] = 0.0;
  1573. tGarage[ i ][ Position ][ 1 ] = 0.0;
  1574. tGarage[ i ][ Position ][ 2 ] = 0.0;
  1575.  
  1576. DestroyPickup( tGarage[ i ][ tgPickup ] );
  1577. Delete3DTextLabel( tGarage[ i ][ tg3D ] );
  1578.  
  1579. new file[ 50 ];
  1580. format( file, sizeof( file ), TG_FILE, i );
  1581. if( fexist( file ) ) { fremove( file ); }
  1582.  
  1583. SendClientMessage( playerid, COLOR_RED, "Successfully deleted tuning garage." );
  1584. return true;
  1585. }
  1586. //==============================================================================
  1587. CMD:money( playerid, params[] ) { // test cmd
  1588. GivePlayerMoney( playerid, 10000 );
  1589. return true;
  1590. }
  1591. //==============================================================================
  1592. CMD:veh1( playerid, params[] ) { // test cmd
  1593.  
  1594. new Float:Pos[ 3 ];
  1595. GetPlayerPos( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1596. new carid = CreateVehicle( 560, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ], 0.0, -1, -1, -1 );
  1597.  
  1598. new engine, lights, alarm, doors, bonnet, boot, objective;
  1599.  
  1600. GetVehicleParamsEx(carid, engine, lights, alarm, doors, bonnet, boot, objective);
  1601. SetVehicleParamsEx(carid, 1, lights, alarm, 0, 0, 0, objective);
  1602. return true;
  1603. }
  1604. //==============================================================================
  1605. CMD:veh2( playerid, params[] ) { // test cmd
  1606.  
  1607. new Float:Pos[ 3 ];
  1608. GetPlayerPos( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1609. new carid = CreateVehicle( 402, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ], 0.0, -1, -1, -1 );
  1610.  
  1611. new engine, lights, alarm, doors, bonnet, boot, objective;
  1612.  
  1613. GetVehicleParamsEx(carid, engine, lights, alarm, doors, bonnet, boot, objective);
  1614. SetVehicleParamsEx(carid, 1, lights, alarm, 0, 0, 0, objective);
  1615. return true;
  1616. }
  1617. //==============================================================================
  1618. CMD:veh3( playerid, params[] ) { // test cmd
  1619.  
  1620. new Float:Pos[ 3 ];
  1621. GetPlayerPos( playerid, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ] );
  1622. new carid = CreateVehicle( 562, Pos[ 0 ],Pos[ 1 ],Pos[ 2 ], 0.0, -1, -1, -1 );
  1623.  
  1624. new engine, lights, alarm, doors, bonnet, boot, objective;
  1625.  
  1626. GetVehicleParamsEx(carid, engine, lights, alarm, doors, bonnet, boot, objective);
  1627. SetVehicleParamsEx(carid, 1, lights, alarm, 0, 0, 0, objective);
  1628. return true;
  1629. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement