Advertisement
Guest User

Untitled

a guest
May 4th, 2015
1,021
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 30.12 KB | None | 0 0
  1. /*
  2. Vehicle functions by Mike (MP2)
  3. http://forum.sa-mp.com/showthread.php?t=339088
  4.  
  5. FEATURES:
  6. - Random vehicle colors (-1 in CreateVehicle) are synced between players
  7. - GetVehicleInterior function
  8. - GetVehicleColor function
  9. - ChangeVehicleColor works with -1 (random) colors
  10. - Siren automatically added to Ladder Firetruck
  11.  
  12. CHANGELOG:
  13. 1.2 (05/05/2015)
  14. - Updated for 0.3.7 (added siren parameter for CreateVehicle and AddStaticVehicleEx
  15. - Removed 'interior' parameter from CreateVehicle/AddStaticVehicleEx to keep in line
  16.     with SA-MP's functions. Use LinkVehicleToInterior or SetVehicleInterior instead.
  17. - Commented out some unfinished code. May get around to finishing it.
  18. - AddStaticVehicle and AddStaticVehicleEx no longer re-direct to CreateVehicle.
  19.     They use their own respective functions
  20. - Using y_hooks again...
  21. - Added GetVehicleSeatCount and GetVehicleModelSeatCount
  22.  
  23. 1.1.3 (10th of February 2013):
  24. - Fixed a bug that caused OnVehicleSpawn to not be called. Caused by another array index out of bounds issue due to me not checking whether a vehicle colour was set to -1 (-1 is an invalid array index).
  25.  
  26. 1.1.2 (7th of February 2013):
  27. - y_hooks no longer used (proper plug-n-play)
  28. - Hooked 'OnVehicleRespray' (reported missing by 'im'
  29.  
  30. 1.1.1 (22nd of January 2013):
  31. - Fixed out of bounds array index issue with vehicle ID 2000.
  32.  
  33. 1.1 (4th of May 2012):
  34. - Removing a paintjob now restores the vehicle's color (fixes SA:MP bug where vehicle became white)
  35. - Added 'GetVehiclePaintjob' function
  36. - Added RemoveVehiclePaintjob (simple macro ('redirect') to ChangeVehiclePaintjob)
  37.  
  38. 1.0 (2nd of May 2012):
  39. - Initial Release
  40.  
  41. NOTE    This include relies on YSI's y_hooks, which can be found here:
  42.         http://forum.sa-mp.com/showthread.php?t=570884
  43.  
  44. */
  45.  
  46. #include <YSI\y_hooks>
  47.  
  48. /*
  49. // Fake Natives - Type 'function(' in pawno to show syntax pop-up
  50. native SetVehicleInterior(vehicleid, interior);
  51. native GetVehicleInterior(vehicleid);
  52. native GetVehicleColor(vehicleid, &color1, &color2);
  53. native GetVehicleColour(vehicleid, &color1, &color2);
  54. native GetVehicleColours(vehicleid, &color1, &color2);
  55. native GetVehicleColors(vehicleid, &color1, &color2);
  56. native GetVehiclePaintjob(vehicleid);
  57.  
  58. native IsVehicleModelAircraft(modelid);
  59. native IsVehicleAircraft(vehicleid);
  60.  
  61. native GetVehicleModelType(modelid);
  62. native GetVehicleType(vehicleid);
  63.  
  64. native GetVehicleSeatCount(vehicleid);
  65. native GetVehicleModelSeatCount(modelid);
  66.  
  67. */
  68.  
  69. #define VTYPE_ROAD 0
  70. #define VTYPE_BIKE 1
  71. #define VTYPE_PLANE 2
  72. #define VTYPE_HELI 3
  73. #define VTYPE_BOAT 4
  74. #define VTYPE_TRAIN 5
  75.  
  76. #define VEHICLE_TYPE_ROAD VTYPE_ROAD
  77. #define VEHICLE_TYPE_BIKE VTYPE_BIKE
  78. #define VEHICLE_TYPE_PLANE VTYPE_PLANE
  79. #define VEHICLE_TYPE_HELI VTYPE_HELI
  80. #define VEHICLE_TYPE_BOAT VTYPE_BOAT
  81. #define VEHCLE_TYPE_TRAIN VTYPE_TRAIN
  82.  
  83. forward OnVehicleCreated(vehicleid);
  84.  
  85. #if !defined isodd
  86. #define isodd(%1) \
  87.     ((%1) & 1)
  88. #endif
  89.  
  90. new gVehicleColors[][] = {
  91. {4,1, 123,1, 113,1, 101,1, 75,1, 62,1, 40,1, 36,1, -1}, // Landstalker
  92. {41,41, 47,47, 52,52, 66,66, 74,74, 87,87,91,91, 113,113, -1}, // Bravura
  93. {10,10, 13,13, 22,22, 30,30, 39,39, 90,90, 98,98, 110,110, -1}, // Buffalo
  94. {36,1, 37,1, 30,1, 28,1, 25,1, 40,1, 101,1, 113,1, -1}, // Linerunner
  95. {113,39, 119,50, 123,92, 109,100, 101,101, 95,105, 83,110, 66,25, -1}, // Perennial
  96. {11,1, 24,1, 36,1, 40,1, 75,1, 91,1, 123,1, 4,1, -1}, // Landstalker
  97. {1,1, -1}, // Dumper
  98. {3,1, -1}, // Firetruck
  99. {26,26, -1}, // Trashmaster
  100. {1,1, -1}, // Stretch
  101. {4,1, 9,1, 10,1, 25,1, 36,1, 40,1, 45,1, 84,1, -1}, // Manana
  102. {12,1, 64,1, 123,1, 116,1, 112,1, 106,1, 80,1, 75,1, -1}, // Infernus
  103. {9,1, 10,8, 11,1, 25,8, 27,1, 29,8, 30,1, 37,8, -1}, // Voodoo
  104. {87,1, 88,1, 91,1, 105,1, 109,1, 119,1, 4,1, 25,1, -1}, // Pony
  105. {25,1, 28,1, 43,1, 67,1, 72,1, 9,1, 95,1, 24,1, -1}, // Mule
  106. {20,1, 25,1, 36,1, 40,1, 62,1, 75,1, 92,1, 0,1, -1}, // Cheetah
  107. {1,3, -1}, // Ambulance
  108. {0,0, -1}, // Leviathan
  109. {119,119, 117,227, 114,114, 108,108, 95,95, 81,81, 61,61, 41,41, -1}, // Moonbeam
  110. {45,75, 47,76, 33,75, 13,76, 54,75, 69,76, 59,75, 87,76, -1}, // Esperanto
  111. {6,1, -1}, // Taxi
  112. {4,1, 13,1, 25,1, 30,1, 36,1, 40,1, 75,1, 95,1, -1}, // Washington
  113. {96,25, 97,25, 101,25, 111,31, 113,36, 83,57, 67,59, -1}, // Bobcat
  114. {1,16, 1,56, 1,17, 1,53, 1,5, 1,35, -1}, // Mr.Whoopie/Mr.Whoopee
  115. {1,0, 2,2, 3,2, 3,6, 6,16, 15,30, 24,53, 35,61, -1}, // BF Injection
  116. {43,0, -1}, // Hunter
  117. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Premier
  118. {0,1, -1}, // Enforcer
  119. {4,75, -1}, // Securicar
  120. {12,12, 13,13, 14,14, 1,2, 2,1, 1,3, 3,1, 10,10, -1}, // Banshee
  121. {46,26, -1}, // Predator
  122. {71,59, 75,59, 92,72, 47,74, 55,83, 59,83, 71,87, 82,87, -1}, // Bus
  123. {43,0, -1}, // Rhino
  124. {43,0, -1}, // Barracks
  125. {1,1, 12,12, 2,2, 6,6, 4,4, 46,46, 53,53, -1}, // Hotknife
  126. {1, 1, -1}, // Articulated Trailer 1
  127. {83,1, 87,1, 92,1, 95,1, 109,1, 119,45, 11,1, -1}, // Previon
  128. {54,7, 79,7, 87,7, 95,16, 98,20, 105,20, 123,20, 125,21, -1}, // Coach
  129. {6,76, -1}, // Cabbie
  130. {57,8, 8,17, 43,21, 54,38, 67,8, 37,78, 65,79, 25,78, -1}, // Stallion
  131. {34,34, 32,32, 20,20, 110,110, 66,66, 84,84, 118,118, 121,121, -1}, // Rumpo
  132. {2,96, 79,42, 82,54, 67,86, 126,96, 70,96, 110,54, 67,98, -1}, // RC Bandit
  133. {0,0, 11,105, 25,109, 36,0, 40,36, 75,36, 0,36, 0,109, -1}, // Romero
  134. {4,1, 20,1, 24,1, 25,1, 36,1, 40,1, 54,1, 84,1, -1}, // Packer
  135. {32,36, 32,42, 32,53, 32,66, 32,14, 32,32, -1}, // Monster
  136. {34,34, 35,35, 37,37, 39,39, 41,41, 43,43, 45,45, 47,47, -1}, // Admiral
  137. {-1}, // Squallo - 4 colors two of which can not be changed, will not be synced
  138. {75,2, -1}, // Seasparrow
  139. {3,6, -1}, // Pizzaboy
  140. {1,74, -1}, // Tram
  141. {1,1, -1}, // Articulated Trailer 2 [NO COLORS]
  142. {123,123, 125,125, 36,36, 16,16, 18,18, 46,46, 61,61, 75,75, -1}, // Turismo
  143. {1,3, 1,5, 1,16, 1,22, 1,35, 1,44, 1,53, 1,57, -1}, // Speeder
  144. {56,56, -1}, // Reefer
  145. {26,26, -1}, // Tropic
  146. {84,15, 84,58, 84,31, 32,74, 43,31, 1,31, 77,31, 32,74, -1}, // Flatbed
  147. {84,63, 91,63, 102,65, 105,72, 110,93, 121,93, 12,95, 23,1, -1}, // Yankee
  148. {58,1, 2,1, 63,1, 18,1, 32,1, 45,1, 13,1, 34,1, -1}, // Caddy
  149. {91,1, 101,1, 109,1, 113,1, 4,1, 25,1, 30,1, 36,1, -1}, // Solair
  150. {26,26, 28,28, 44,44, 51,51, 57,57, 72,72, 106,106, 112,112, -1}, // Berkley's RC Van (Topfun)
  151. {1,3, 1,9, 1,18, 1,30, 17,23, 46,23, 46,32, 57,34, -1}, // Skimmer
  152. {36,1, 37,1, 43,1, 53,1, 61,1, 75,1, 79,1, 88,1, -1}, // PCJ-600
  153. {12,12, 13,13, 14,14, 1,2, 2,1, 1,3, 3,1, 10,10, -1}, // Faggio
  154. {79,79, 84,84, 7,7, 11,11, 19,19, 22,22, 36,36, 53,53, -1}, // Freeway
  155. {14,75, -1}, // RC Baron
  156. {14,75, -1}, // RC Raider
  157. {67,76, 68,76, 78,76, 2,76, 16,76, 18,76, 25,76, 45,88, -1}, // Glendale
  158. {51,1, 58,8, 60,1, 68,8, 2,1, 13,8, 22,1, 36,8, -1}, // Oceanic
  159. {6,6, 46,46, 53,53, 3,3, -1}, // Sanchez
  160. {1,3, -1}, // Sparrow
  161. {43,0, -1}, // Patriot
  162. {120,117, 103,111, 120,114, 74,91, 120,112, 74,83, 120,113, 66,71, -1}, // Quad
  163. {56,15, 56,53, -1}, // Coastguard
  164. {56,15, 56,53, -1}, // Dinghy
  165. {97,1, 81,1, 105,1, 110,1, 91,1, 74,1, 84,1, 83,1, -1}, // Hermes
  166. {2,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29, -1}, // Sabre
  167. {6,7, 7,6, 1,6, 89,91, 119,117, 103,102, 77,87, 71,77, -1}, // Rustler
  168. {92,1, 94,1, 101,1, 121,1, 0,1, 22,1, 36,1, 75,1, -1}, // ZR-350
  169. {72,1, 66,1, 59,1, 45,1, 40,1, 39,1, 35,1, 20,1, -1}, // Walton
  170. {27,36, 59,36, 60,35, 55,41, 54,31, 49,23, 45,32, 40,29, -1}, // Regina
  171. {73,45, 12,12, 2,2, 6,6, 4,4, 46,46, 53,53, -1}, // Comet
  172. {1,1, 3,3, 6,6, 46,46, 65,9, 14,1, 12,9, 26,1, -1}, // BMX
  173. {41,41, 48,48, 52,52, 64,64, 71,71, 85,85, 10,10, 62,62, -1}, // Burrito
  174. {-1}, // Camper [4 colors - can not be synced]
  175. {12,35, 50,32, 40,26, 66,36, -1}, // Marquis
  176. {1,73, 1,74, 1,75, 1,76, 1,77, 1,78, 1,79, -1}, // Baggage
  177. {1,1, -1}, // Dozer
  178. {26,14, 29,42, 26,57, 54,29, 26,3, 3,29, 12,39, 74,35, -1}, // Maverick
  179. {2,26, 2,29, -1}, // News Macerick/News Helicopter
  180. {13,118, 14,123, 120,123, 112,120, 84,110, 76,102, -1}, // Rancher
  181. {0,0, -1}, // FBI Rancher
  182. {40,65, 71,72, 52,66, 64,72, 30,72, 60,72, -1}, // Virgo
  183. {30,26, 77,26, 81,27, 24,55, 28,56, 49,59, 52,69, 71,107, -1}, // Greenwood
  184. {36,13, -1}, // Jetmax
  185. {36,117, 36,13, 42,30, 42,33, 54,36, 75,79, 92,101, 98,109, -1}, // Hotring Racer
  186. {123,124, 119,122, 118,117, 116,115, 114,108, 101,106, 88,99, 5,6, -1}, // Sandking
  187. {74,72, 66,72, 53,56, 37,19, 22,22, 20,20, 9,14, 0,0, -1}, // Blista Compact
  188. {0,1, -1}, // Police Maverick/Police Helicopter
  189. {11,123, 13,120, 20,117, 24,112, 27,107, 36,105, 37,107, 43,93, -1}, // Boxville
  190. {109,25, 109,32, 112,32, 10,32, 30,44, 32,52, 84,66, 84,69, -1}, // Benson
  191. {75,84, 40,84, 40,110, 28,119, 25,119, 21,119, 13,119, 4,119, -1}, // Mesa
  192. {14,75, -1}, // RC Goblin
  193. {7,94, 36,88, 51,75, 53,75 ,58,67, 75,67, 75,61, 79,62, -1}, // Hotring Racer A
  194. {83,66, 87,74, 87,75, 98,83, 101,100, 103,101, 117,116, 123,36, -1}, // Hotring Racer B
  195. {51,39, 57,38, 45,29, 34,9, 65,9, 14,1, 12,9, 26,1, -1}, // Bloodring Banger
  196. {13,118, 14,123, 120,123, 112,120, 84,110, 76,102, -1}, // Rancher (LURE)
  197. {3,3, 6,6, 7,7, 52,52, 76,76, -1}, // Super GT
  198. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Elegant
  199. {1,1, -1}, // Journey
  200. {7,1, 74,1, 61,1, 16,1, 25,1, 30,1, 36,1, 53,1, -1}, // Bike
  201. {43,43, 46,46, 39,39, 28,28, 16,16, 6,6, 5,5, 2,2, -1}, // Mountain Bike
  202. {3,90, 4,90, 7,68, 8,66, 12,60, 27,97, 34,51, 37,51, -1}, // Beagle
  203. {17,39, 15,123, 32,112, 45,88, 52,71, 57,67, 61,96, 96,96, -1}, // Cropduster
  204. {38,51, 21,36, 21,34, 30,34, 54,34, 55,20, 48,18, 51,6, -1}, // Stuntplane
  205. {10,1, 25,1, 28,1, 36,1, 40,1, 54,1, 75,1, 113,1, -1}, // Tanker
  206. {13,76, 24,77, 63,78, 42,76, 54,77, 39,78, 11,76, 62,77, -1}, // Roadtrain
  207. {116,1, 119,1, 122,1, 4,1, 9,1, 24,1, 27,1, 36,1, -1}, // Nebula
  208. {37,36, 36,36, 40,36, 43,41, 47,41, 51,72, 54,75, 55,84, -1}, // Majestic
  209. {2,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29, -1}, // Buccaneer
  210. {1,1, -1}, // Shamal
  211. {-1}, // Hydra [NO DATA FOUND]
  212. {74,74, 75,13, 87,118, 92,3, 115,118, 25,118, 36,0, 118,118, -1}, // FCR-900
  213. {3,3, 3,8, 6,25, 7,79, 8,82, 36,105, 39,106, 51,118, -1}, // NRG-500
  214. {-1}, // Cop Bike [NO DATA FOUND]
  215. {-1}, // Cement [4 colors - not synced]
  216. {1,1, 17,20, 18,20, 22,30, 36,43, 44,51, 52,54, -1}, // Towtruck
  217. {2,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29, -1}, // Fortune
  218. {52,1, 53,1, 66,1, 75,1, 76,1, 81,1, 95,1, 109,1, -1}, // Cadrona
  219. {-1}, // FBI Truck [ NO DATA FOUND]
  220. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Willard
  221. {110,1, 111,1, 112,1, 114,1, 119,1, 122,1, 4,1, 13,1, -1}, // Forklift
  222. {2,35, 36,2, 51,53, 91,2, 11,22, 40,35, -1}, // Tractor
  223. {-1}, // Combine [NO DATA FOUND]
  224. {73,1, 74,1, 75,1, 77,1, 79,1, 83,1, 84,1, 91,1, -1}, // Feltzer
  225. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Remington
  226. {3,1, 28,1, 31,1, 55,1, 66,1, 97,1, 123,1, 118,1, -1}, // Slamvan
  227. {9,1, 12,1, 26,96, 30,96, 32,1, 37,1, 57,96, 71,96, -1}, // Blade
  228. {1,1, -1}, // Freight
  229. {1,1, -1}, // Streak
  230. {96,67, 86,70, 79,74, 70,86, 61,98, 75,75, 75,91, -1}, // Vortex
  231. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Vincent
  232. {51,1, 58,8, 60,1, 68,8, 2,1, 13,8, 22,1, 36,8, -1}, // Bullet
  233. {13,118, 24,118, 31,93, 32,92, 45,92, 113,92, 119,113, 122,113, -1}, // Clover
  234. {76,8, 32,8, 43,8, 67,8, 11,11, 8,90, 2,2, 83,13, -1}, // Sadler
  235. {3,1, -1}, // Firetruck LA (Ladder Truck)
  236. {50,1, 47,1, 44,96, 40,96, 39,1, 30,1, 28,96, 9,96, -1}, // Hustler
  237. {62,37, 78,38, 2,62, 3,87, 2,78, 113,78, 119,62, 7,78, -1}, // Intruder
  238. {122,1, 123,1, 125,1, 10,1, 24,1, 37,1, 55,1, 66,1, -1}, // Primo
  239. {1,1, -1}, // Cargobob
  240. {74,39, 72,39, 75,39, 79,39, 83,36, 84,36, 89,35, 91,35, -1}, // Tampa
  241. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Sunrise
  242. {67,1, 72,1, 75,1, 83,1, 91,1, 101,1, 109,1, 20,1, -1}, // Merit
  243. {56,56, 49,49, 26,124, -1}, // Utility
  244. {38,9, 55,23, 61,74, 71,87, 91,87, 98,114, 102,119, 111,3, -1}, // Nevada
  245. {53,32, 15,32, 45,32, 34,30, 65,32, 14,32, 12,32, 43,32, -1}, // Yosemite
  246. {51,1, 58,1, 60,1, 68,1, 2,1, 13,1, 22,1, 36,1, -1}, // Windsor
  247. {1,1, -1}, // Monster A
  248. {1,1, -1}, // Monster B
  249. {112,1, 116,1, 117,1, 24,1, 30,1, 35,1, 36,1, 40,1, -1}, // Uranus
  250. {51,1, 58,8, 60,1, 68,8, 2,1, 13,8, 22,1, 36,8, -1}, // Jester
  251. {52,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29, -1}, // Sultan
  252. {57,8, 8,17, 43,21, 54,38, 67,8, 37,78, 65,79, 25,78, -1}, // Stratum
  253. {36,1, 35,1, 17,1, 11,1, 116,1, 113,1, 101,1, 92,1, -1}, // Elegy
  254. {1,6, -1}, // Raindance
  255. {-1}, // RC Tiger [NO DATA FOUND]
  256. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Flash
  257. {109,1, 30,8, 95,1, 84,8, 83,1, 72,8, 71,1, 52,8, -1}, // Tahoma
  258. {97,96, 88,64, 90,96, 93,64, 97,96, 99,81, 102,114, 114,1, -1}, // Savanna
  259. {2,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29, -1}, // Bandito
  260. {1,1, -1}, // Freight Flat Carriage
  261. {1,1, -1}, // Streak Carriage
  262. {2,35, 36,2, 51,53, 91,2, 11,22, 40,35, -1}, // Kart
  263. {94,1, 101,1, 116,1, 117,1, 4,1, 25,1, 30,1, 37,1, -1}, // Mower
  264. {91,38, 115,43, 85,6, 79,7, 78,8, 77,18, 79,18, 86,24, -1}, // Duneride
  265. {26,26, -1}, // Sweeper
  266. {12,1, 19,96, 31,64, 25,96, 38,1, 51,96, 57,1, 66,96, -1}, // Broadway
  267. {67,1, 68,96, 72,1, 74,8, 75,96, 76,8, 79,1, 84,96, -1}, // Tornado
  268. {1,3, 8,7, 8,10, 8,16, 23,31, 40,44, -1}, // AT-400
  269. {1,1, -1}, // DFT-30
  270. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Huntley
  271. {92,92, 81,81, 67,67, 66,66, 61,61, 53,53, 51,51, 47,47, 43,43, -1}, // Stafford
  272. {54,1, 58,1, 66,1, 72,1, 75,1, 87,1, 101,1, 36,1, -1}, // BF-400
  273. {41,10, 41,20, 49,11, 56,123, 110,113, 112,116, 114,118, 119,101, -1}, // Newsvan/news Van
  274. {1,1, -1}, // Tug
  275. {1,1, -1}, // Petrol Trailer
  276. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Emperor
  277. {119,1, 122,1, 8,1, 10,1, 13,1, 25,1, 27,1, 32,1, -1}, // Wayfarer
  278. {36,1, 40,1, 43,1, 53,1, 72,1, 75,1, 95,1, 101,1, -1}, // Euros
  279. {1,1, -1}, // Hotdog
  280. {37,37, 31,31, 23,23, 22,22, 7,7, 124,124, 114,114, 112,112, -1}, // Club
  281. {-1}, // Freight Box Carriage [NO DATA FOUND]
  282. {1,1, -1}, // Articulated Trailer 3
  283. {1,1, -1}, // Andromada
  284. {51,1, 58,8, 60,1, 68,8, 2,1, 13,8, 22,1, 36,8, -1}, // Dodo
  285. {-1}, // RC Cam [NO DATA FOUND]
  286. {112,20, -1}, // Launch
  287. {0,1, -1}, // Cop Car LSPD
  288. {0,1, -1}, // Cop Car SFPD
  289. {0,1, -1}, // Cop Car LVPD
  290. {0,1, -1}, // Cop Car Ranger (Police Ranger)
  291. {81,8, 32,8, 43,8, 67,8, 11,11, 8,90, 2,2, 83,13, -1}, // Picador
  292. {1,1, -1}, // Swatvan S.W.A.T Van
  293. {58,1, 69,1, 75,77, 18,1, 32,1, 45,45, 13,1, 34,1, -1}, // Alpha
  294. {58,1, 69,1, 75,77, 18,1, 32,1, 45,45, 13,1, 34,1, -1}, // Phoenix
  295. {67,76, 68,76, 78,76, 2,76, 16,76, 18,76, 25,76, 45,88, -1}, // Glendale Shit
  296. {61,8, 32,8, 43,8, 67,8, 11,11, 8,90, 2,2, 83,13, -1}, // Sadler Shit
  297. {-1}, // Baggage Box A [NO DATA FOUND]
  298. {-1}, // Baggage Box B [NO DATA FOUND]
  299. {1,1, -1}, // Tug Stairs
  300. {36,36, -1}, // Burglary Boxville
  301. {-1}, // Farm Plow Trailer [NO DATA FOUND]
  302. {-1} // Utility Trailer [NO DATA FOUND]
  303. };
  304.  
  305. new stock const VFUNC_vTypeArray[] = {
  306. VTYPE_ROAD, // Landstalker
  307. VTYPE_ROAD, // Bravura
  308. VTYPE_ROAD, // Buffalo
  309. VTYPE_ROAD, // Linerunner
  310. VTYPE_ROAD, // Perenniel
  311. VTYPE_ROAD, // Sentinel
  312. VTYPE_ROAD, // Dumper
  313. VTYPE_ROAD, // Firetruck
  314. VTYPE_ROAD, // Trashmaster
  315. VTYPE_ROAD, // Stretch
  316. VTYPE_ROAD, // Manana
  317. VTYPE_ROAD, // Infernus
  318. VTYPE_ROAD, // Voodoo
  319. VTYPE_ROAD, // Pony
  320. VTYPE_ROAD, // Mule
  321. VTYPE_ROAD, // Cheetah
  322. VTYPE_ROAD, // Ambulance
  323. VTYPE_HELI, // Leviathan
  324. VTYPE_ROAD, // Moonbeam
  325. VTYPE_ROAD, // Esperanto
  326. VTYPE_ROAD, // Taxi
  327. VTYPE_ROAD, // Washington
  328. VTYPE_ROAD, // Bobcat
  329. VTYPE_ROAD, // Mr Whoopee (Ice-Cream Truck)
  330. VTYPE_ROAD, // BF Injection
  331. VTYPE_HELI, // Hunter
  332. VTYPE_ROAD, // Permier
  333. VTYPE_ROAD, // Enforcer
  334. VTYPE_ROAD, // Securicar
  335. VTYPE_ROAD, // Banshee
  336. VTYPE_BOAT, // Predator
  337. VTYPE_ROAD, // Bus
  338. VTYPE_ROAD, // Rhino
  339. VTYPE_ROAD, // Barracks
  340. VTYPE_ROAD, // Hotknife
  341. VTYPE_ROAD, // Articulated Trailer 1
  342. VTYPE_ROAD, // Previon
  343. VTYPE_ROAD, // Coach
  344. VTYPE_ROAD, // Cab
  345. VTYPE_ROAD, // Stallion
  346. VTYPE_ROAD, // Rumpo
  347. VTYPE_ROAD, // RC Bandit
  348. VTYPE_ROAD, // Romero
  349. VTYPE_ROAD, // Packer
  350. VTYPE_ROAD, // Monster
  351. VTYPE_ROAD, // Admiral
  352. VTYPE_BOAT, // Squallo
  353. VTYPE_HELI, // Seasparrow
  354. VTYPE_BIKE, // Pizzaboy
  355. VTYPE_ROAD, // Tram
  356. VTYPE_ROAD, // Art Trailer 2
  357. VTYPE_ROAD, // Turismo
  358. VTYPE_BOAT, // Speeder
  359. VTYPE_BOAT, // Reefer
  360. VTYPE_BOAT, // Tropic
  361. VTYPE_ROAD, // Flatbed
  362. VTYPE_ROAD, // Yankee
  363. VTYPE_ROAD, // Caddy
  364. VTYPE_ROAD, // Solair
  365. VTYPE_ROAD, // Topfun
  366. VTYPE_PLANE, // Skimmer
  367. VTYPE_BIKE, // PCJ-600
  368. VTYPE_BIKE, // Faggio
  369. VTYPE_BIKE, // Freeway
  370. VTYPE_PLANE, // RC Baron
  371. VTYPE_HELI, // RC Raider
  372. VTYPE_ROAD, // Glendale
  373. VTYPE_ROAD, // Oceanic
  374. VTYPE_BIKE, // Sanchez
  375. VTYPE_HELI, // Sparrow
  376. VTYPE_ROAD, // Patriot
  377. VTYPE_ROAD, // Quad
  378. VTYPE_BOAT, // Coastguard
  379. VTYPE_BOAT, // Dinghy
  380. VTYPE_ROAD, // Hermes
  381. VTYPE_ROAD, // Sasbre
  382. VTYPE_PLANE, // Rustler
  383. VTYPE_ROAD, // ZR-350
  384. VTYPE_ROAD, // Walton
  385. VTYPE_ROAD, // Regina
  386. VTYPE_ROAD, // Comet
  387. VTYPE_BIKE, // BMX
  388. VTYPE_ROAD, // Burrito
  389. VTYPE_ROAD, // Camper
  390. VTYPE_BOAT, // Marquis
  391. VTYPE_ROAD, // Baggage
  392. VTYPE_ROAD, // Dozer
  393. VTYPE_HELI, // Maverick
  394. VTYPE_HELI, // News Heli
  395. VTYPE_ROAD, // Rancher
  396. VTYPE_ROAD, // FBI Rancher
  397. VTYPE_ROAD, // Virgo
  398. VTYPE_ROAD, // Greenwood
  399. VTYPE_BOAT, // Jetmax
  400. VTYPE_ROAD, // Hotring
  401. VTYPE_ROAD, // Sandking
  402. VTYPE_ROAD, // Blista Compact
  403. VTYPE_HELI, // Police Maverick (polmav)
  404. VTYPE_ROAD, // Boxville
  405. VTYPE_ROAD, // Benson
  406. VTYPE_ROAD, // Mesa
  407. VTYPE_HELI, // RC Goblin
  408. VTYPE_ROAD, // Hotring
  409. VTYPE_ROAD, // Hotring
  410. VTYPE_ROAD, // Bloodring Bander
  411. VTYPE_ROAD, // Rancher
  412. VTYPE_ROAD, // Super GT
  413. VTYPE_ROAD, // Elegant
  414. VTYPE_ROAD, // Journey
  415. VTYPE_BIKE, // Bike
  416. VTYPE_BIKE, // Mountain Bike
  417. VTYPE_PLANE, // Beagle
  418. VTYPE_PLANE, // Cropduster
  419. VTYPE_PLANE, // Stuntplane
  420. VTYPE_ROAD, // Tanker
  421. VTYPE_ROAD, // Roadtrain
  422. VTYPE_ROAD, // Nebula
  423. VTYPE_ROAD, // Majestic
  424. VTYPE_ROAD, // Buccaneer
  425. VTYPE_PLANE, // Shamal
  426. VTYPE_PLANE, // Hydra
  427. VTYPE_BIKE, // FCR-900
  428. VTYPE_BIKE, // NRG-500
  429. VTYPE_BIKE, // HPV (Cop Bike)
  430. VTYPE_ROAD, // Cement
  431. VTYPE_ROAD, // Towtruck
  432. VTYPE_ROAD, // Fortune
  433. VTYPE_ROAD, // Cadrona
  434. VTYPE_ROAD, // FBI Truck
  435. VTYPE_ROAD, // Willard
  436. VTYPE_ROAD, // Forklift
  437. VTYPE_ROAD, // Tractor
  438. VTYPE_ROAD, // Combine
  439. VTYPE_ROAD, // Feltzer
  440. VTYPE_ROAD, // Remington
  441. VTYPE_ROAD, // Slamvan
  442. VTYPE_ROAD, // Blade
  443. VTYPE_TRAIN, // Freight
  444. VTYPE_TRAIN, // Brownstreak
  445. VTYPE_ROAD, // Vortex
  446. VTYPE_ROAD, // Vincent
  447. VTYPE_ROAD, // Bullet
  448. VTYPE_ROAD, // Clover
  449. VTYPE_ROAD, // Sadler
  450. VTYPE_ROAD, // Firetruck
  451. VTYPE_ROAD, // Hustler
  452. VTYPE_ROAD, // Intruder
  453. VTYPE_ROAD, // Primo
  454. VTYPE_HELI, // Cargobob
  455. VTYPE_ROAD, // Tampa
  456. VTYPE_ROAD, // Sunrise
  457. VTYPE_ROAD, // Merit
  458. VTYPE_ROAD, // Utility
  459. VTYPE_PLANE, // Nevada
  460. VTYPE_ROAD, // Yosemite
  461. VTYPE_ROAD, // Windsor
  462. VTYPE_ROAD, // Monster
  463. VTYPE_ROAD, // Monster
  464. VTYPE_ROAD, // Uranus
  465. VTYPE_ROAD, // Jester
  466. VTYPE_ROAD, // Sultan
  467. VTYPE_ROAD, // Stratum
  468. VTYPE_ROAD, // Elegy
  469. VTYPE_HELI, // Raindance
  470. VTYPE_ROAD, // RC Tiger
  471. VTYPE_ROAD, // Flash
  472. VTYPE_ROAD, // Tahoma
  473. VTYPE_ROAD, // Savanna
  474. VTYPE_ROAD, // Bandito
  475. VTYPE_TRAIN, // Carriage
  476. VTYPE_TRAIN, // Carriage
  477. VTYPE_ROAD, // Kart
  478. VTYPE_ROAD, // Mower
  479. VTYPE_ROAD, // Done
  480. VTYPE_ROAD, // Sweeper
  481. VTYPE_ROAD, // Broadway
  482. VTYPE_ROAD, // Tornado
  483. VTYPE_PLANE, // AT-400
  484. VTYPE_ROAD, // DFT-30
  485. VTYPE_ROAD, // Huntley
  486. VTYPE_ROAD, // Stafford
  487. VTYPE_BIKE, // BF-400
  488. VTYPE_ROAD, // Newsvan
  489. VTYPE_ROAD, // Tug
  490. VTYPE_ROAD, // Petrol Trailer
  491. VTYPE_ROAD, // Emperor
  492. VTYPE_BIKE, // Wayfarer
  493. VTYPE_ROAD, // Euros
  494. VTYPE_ROAD, // Hotdog
  495. VTYPE_ROAD, // Club
  496. VTYPE_TRAIN, // Freight Box Trailer
  497. VTYPE_ROAD, // Artic Trailer
  498. VTYPE_PLANE, // Androm
  499. VTYPE_PLANE, // Dodo
  500. VTYPE_ROAD, // RC Cam
  501. VTYPE_BOAT, // Launch
  502. VTYPE_ROAD, // LSPD
  503. VTYPE_ROAD, // SFPD
  504. VTYPE_ROAD, // LVPD
  505. VTYPE_ROAD, // Police Ranger
  506. VTYPE_ROAD, // Picador
  507. VTYPE_ROAD, // S.W.A.T
  508. VTYPE_ROAD, // Alpha
  509. VTYPE_ROAD, // Phoenix
  510. VTYPE_ROAD, // Glendale Shit
  511. VTYPE_ROAD, // Sadler Shit
  512. VTYPE_ROAD, // Baggage
  513. VTYPE_ROAD, // Baggage
  514. VTYPE_ROAD, // Stairs
  515. VTYPE_ROAD, // Boxville
  516. VTYPE_ROAD, // Plow
  517. VTYPE_ROAD // Utility Trailer
  518. };
  519.  
  520. // Functions for vehicle types
  521.  
  522. #define IsVehicleModelAircraft(%0) (VFUNC_vTypeArray[%0-400] == VTYPE_PLANE || VFUNC_vTypeArray[%0-400] == VTYPE_HELI)
  523. #define IsVehicleAircraft(%0) (VFUNC_vTypeArray[GetVehicleModel(%0)-400] == VTYPE_PLANE || VFUNC_vTypeArray[GetVehicleModel(%0)-400] == VTYPE_HELI)
  524.  
  525.  
  526. #define GetVehicleModelType(%0) VFUNC_vTypeArray[%0-400]
  527. #define GetVehicleType(%0) VFUNC_vTypeArray[GetVehicleModel(%0)-400]
  528.  
  529. enum VFUNC_VDATA_ENUM
  530. {
  531.     gVeh_Interior,
  532.     gVeh_Color1,
  533.     gVeh_Color2,
  534.     gVeh_SpawnColor1,
  535.     gVeh_SpawnColor2,
  536.     gVeh_Paintjob
  537. }
  538.  
  539. new vehicleData[MAX_VEHICLES+1][VFUNC_VDATA_ENUM];
  540.  
  541. stock vfunc_CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, siren=0)
  542. {
  543.     if(modelid < 400 || modelid > 610) return 0; // Invalid model
  544.    
  545.     if(modelid == 569 || modelid == 570 || modelid == 537 || modelid == 538) // Trains, use AddStaticVehicle
  546.     {
  547.         new vid = AddStaticVehicle(modelid, x, y, z, rotation, color1, color2);
  548.         return vid;
  549.     }
  550.    
  551.     new c1 = color1, c2 = color2;
  552.    
  553.     // Add siren to ladder firetruck
  554.     if(modelid == 544) siren = 1;
  555.  
  556.     if((color1 == -1 || color2 == -1) && gVehicleColors[modelid-400][0] != -1) // Random colors, yay!
  557.     {
  558.         // Get the max index
  559.         new index;
  560.         for(new i=0; i<20; i++)
  561.         {
  562.             if(gVehicleColors[modelid-400][i] == -1)
  563.             {
  564.                 index = i;
  565.                 break;
  566.             }
  567.         }
  568.         new RandCol = random(index);
  569.         if(isodd(RandCol)) RandCol--;
  570.         if(color1 == -1) c1 = gVehicleColors[modelid-400][RandCol];
  571.         if(color2 == -1) c2 = gVehicleColors[modelid-400][RandCol+1];
  572.     }
  573.     new vid = CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:rotation, c1, c2, respawn_delay, siren);
  574.    
  575.     vehicleData[vid][gVeh_Interior] = 0;
  576.     vehicleData[vid][gVeh_Color1] = c1;
  577.     vehicleData[vid][gVeh_Color2] = c2;
  578.  
  579.     vehicleData[vid][gVeh_SpawnColor1] = color1;
  580.     vehicleData[vid][gVeh_SpawnColor2] = color2;
  581.    
  582.     vehicleData[vid][gVeh_Paintjob] = 3;
  583.    
  584.     CallRemoteFunction("OnVehicleCreated", "i", vid);
  585.     return vid;
  586. }
  587.  
  588. #if defined _ALS_CreateVehicle
  589.     #undef CreateVehicle
  590. #else
  591.     #define _ALS_CreateVehicle
  592. #endif
  593. #define CreateVehicle vfunc_CreateVehicle
  594.  
  595. stock vfunc_AddStaticVehicle(modelid, Float:x, Float:y, Float:z, Float:rotation, color1, color2)
  596. {
  597.     if(modelid < 400 || modelid > 610) return 0; // Invalid model
  598.  
  599.     if(modelid == 569 || modelid == 570 || modelid == 537 || modelid == 538) // Trains, use AddStaticVehicle
  600.     {
  601.         new vid = AddStaticVehicle(modelid, x, y, z, rotation, color1, color2);
  602.         return vid;
  603.     }
  604.  
  605.     new c1 = color1, c2 = color2;
  606.  
  607.     if((color1 == -1 || color2 == -1) && gVehicleColors[modelid-400][0] != -1) // Random colors, yay!
  608.     {
  609.         // Get the max index
  610.         new index;
  611.         for(new i=0; i<20; i++)
  612.         {
  613.             if(gVehicleColors[modelid-400][i] == -1)
  614.             {
  615.                 index = i;
  616.                 break;
  617.             }
  618.         }
  619.         new RandCol = random(index);
  620.         if(isodd(RandCol)) RandCol--;
  621.         if(color1 == -1) c1 = gVehicleColors[modelid-400][RandCol];
  622.         if(color2 == -1) c2 = gVehicleColors[modelid-400][RandCol+1];
  623.     }
  624.     new vid = AddStaticVehicle(modelid, Float:x, Float:y, Float:z, Float:rotation, c1, c2);
  625.  
  626.     vehicleData[vid][gVeh_Interior] = 0;
  627.     vehicleData[vid][gVeh_Color1] = c1;
  628.     vehicleData[vid][gVeh_Color2] = c2;
  629.  
  630.     vehicleData[vid][gVeh_SpawnColor1] = color1;
  631.     vehicleData[vid][gVeh_SpawnColor2] = color2;
  632.  
  633.     vehicleData[vid][gVeh_Paintjob] = 3;
  634.  
  635.     CallRemoteFunction("OnVehicleCreated", "i", vid);
  636.    
  637.     return vid;
  638. }
  639. #if defined _ALS_AddStaticVehicle
  640.     #undef AddStaticVehicle
  641. #else
  642.     #define _ALS_AddStaticVehicle
  643. #endif
  644. #define AddStaticVehicle vfunc_AddStaticVehicle
  645.  
  646. stock vfunc_AddStaticVehicleEx(modelid, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, siren=0)
  647. {
  648.     if(modelid < 400 || modelid > 610) return 0; // Invalid model
  649.  
  650.     if(modelid == 569 || modelid == 570 || modelid == 537 || modelid == 538) // Trains, use AddStaticVehicle
  651.     {
  652.         new vid = AddStaticVehicle(modelid, x, y, z, rotation, color1, color2);
  653.         return vid;
  654.     }
  655.  
  656.     new c1 = color1, c2 = color2;
  657.  
  658.     // Add siren to ladder firetruck
  659.     if(modelid == 544) siren = 1;
  660.  
  661.     if((color1 == -1 || color2 == -1) && gVehicleColors[modelid-400][0] != -1) // Random colors, yay!
  662.     {
  663.         // Get the max index
  664.         new index;
  665.         for(new i=0; i<20; i++)
  666.         {
  667.             if(gVehicleColors[modelid-400][i] == -1)
  668.             {
  669.                 index = i;
  670.                 break;
  671.             }
  672.         }
  673.         new RandCol = random(index);
  674.         if(isodd(RandCol)) RandCol--;
  675.         if(color1 == -1) c1 = gVehicleColors[modelid-400][RandCol];
  676.         if(color2 == -1) c2 = gVehicleColors[modelid-400][RandCol+1];
  677.     }
  678.     new vid = AddStaticVehicleEx(modelid, Float:x, Float:y, Float:z, Float:rotation, c1, c2, respawn_delay, siren);
  679.  
  680.     vehicleData[vid][gVeh_Interior] = 0;
  681.     vehicleData[vid][gVeh_Color1] = c1;
  682.     vehicleData[vid][gVeh_Color2] = c2;
  683.  
  684.     vehicleData[vid][gVeh_SpawnColor1] = color1;
  685.     vehicleData[vid][gVeh_SpawnColor2] = color2;
  686.  
  687.     vehicleData[vid][gVeh_Paintjob] = 3;
  688.  
  689.     CallRemoteFunction("OnVehicleCreated", "i", vid);
  690.    
  691.     return vid;
  692. }
  693. #if defined _ALS_AddStaticVehicleEx
  694.     #undef AddStaticVehicleEx
  695. #else
  696.     #define _ALS_AddStaticVehicleEx
  697. #endif
  698. #define AddStaticVehicleEx vfunc_AddStaticVehicleEx
  699.  
  700. stock vfunc_LinkVehicleToInterior(vehicleid, interior)
  701. {
  702.     if(vehicleid < 1 || vehicleid > MAX_VEHICLES) return 0; // Invalid vehicleid
  703.     vehicleData[vehicleid][gVeh_Interior] = interior;
  704.     return LinkVehicleToInterior(vehicleid, interior);
  705. }
  706.  
  707. #if defined _ALS_LinkVehicleToInterior
  708.     #undef LinkVehicleToInterior
  709. #else
  710.     #define _ALS_LinkVehicleToInterior
  711. #endif
  712. #define LinkVehicleToInterior vfunc_LinkVehicleToInterior
  713.  
  714. #if !defined SetVehicleInterior
  715. #define SetVehicleInterior LinkVehicleToInterior
  716. #endif
  717.  
  718. #if !defined GetVehicleInterior
  719. stock GetVehicleInterior(vehicleid)
  720. {
  721.     if(vehicleid < 1 || vehicleid > MAX_VEHICLES) return 0; // Invalid vehicleid
  722.     return vehicleData[vehicleid][gVeh_Interior];
  723. }
  724. #endif
  725.  
  726. #if !defined GetVehicleColor
  727. stock GetVehicleColor(vehicleid, &color1, &color2)
  728. {
  729.     if(vehicleid < 1 || vehicleid > MAX_VEHICLES) return 0; // Invalid vehicleid
  730.     color1 = vehicleData[vehicleid][gVeh_Color1];
  731.     color2 = vehicleData[vehicleid][gVeh_Color2];
  732.     return vehicleData[vehicleid][gVeh_Color1];
  733. }
  734. #endif
  735.  
  736. #define GetVehicleColors GetVehicleColor
  737. #define GetVehicleColours GetVehicleColor
  738. #define GetVehicleColour GetVehicleColor
  739.  
  740. // Number of seats for every vehicle.
  741. // Comments indicate LAST vehicle on row.
  742. new static stock const gVehicleSeatCounts[212] =
  743. {
  744.     4,2,2,2,4,4,1,2,2,4, // Stretch
  745.     2,2,2,4,2,2,4,2,4,2, // Esperanto
  746.     4,2,2,2,2,1,4,4,4,2, // Banshee
  747.     1,9,1,2,2,1,2,9,4,2, // Stallion
  748.     4,1,2,2,2,4,1,2,1,2, // Tram
  749.     1,2,1,1,1,2,2,2,4,4, // Berkley's RC Van
  750.     2,2,2,2,1,1,4,4,2,2, // Sparrow
  751.     4,2,1,1,2,2,1,2,2,4, // Regina
  752.     2,1,2,3,1,1,1,4,2,2, // Rancher
  753.     4,2,4,1,2,2,2,4,4,2, // Benson
  754.     2,1,2,2,2,2,2,4,2,1, // Bike
  755.     1,2,1,1,2,2,4,2,2,1, // Shamal
  756.     1,2,2,2,2,2,2,2,2,4, // Willard
  757.     1,1,1,2,2,2,2,2,2,1, // Vortex
  758.     4,2,2,2,2,2,4,4,2,2, // Tampa
  759.     4,4,2,1,2,2,2,2,2,2, // Jester
  760.     4,4,2,2,1,2,4,4,1,1, // Freight Trailer
  761.     1,1,1,2,1,2,2,2,2,4, // Huntley
  762.     4,2,4,1,1,4,2,2,2,2, // Club
  763.     1,1,2,2,1,1,4,4,4,2, // Police Ranger
  764.     2,2,2,2,4,2,1,1,1,4, // Boxville
  765.     1,1                  // Utility Trailer
  766. };
  767.  
  768. stock GetVehicleSeatCount(vehicleid)
  769. {
  770.     if(vehicleid < 1 || vehicleid > MAX_VEHICLES) return 0; // Invalid vehicle ID
  771.    
  772.     new model = GetVehicleModel(vehicleid);
  773.     if(model == 0) return 0; // Vehicle does not exist
  774.    
  775.     return gVehicleSeatCounts[model-400];
  776. }
  777.  
  778. stock GetVehicleModelSeatCount(modelid)
  779. {
  780.     if(modelid < 400 || modelid > 611) return 0; // Invalid model ID
  781.     return gVehicleSeatCounts[modelid-400];
  782. }
  783.  
  784. stock vfunc_ChangeVehicleColor(vehicleid, color1, color2, paintjob=0)
  785. {
  786.     if(vehicleid < 1 || vehicleid > MAX_VEHICLES) return 0; // Invalid vehicleid
  787.    
  788.     if((color1 == -1 || color2 == -1) && gVehicleColors[GetVehicleModel(vehicleid)-400][0] != -1) // Random colors, yay!
  789.     {
  790.         // Get the max index
  791.         new index;
  792.         for(new i=0; i<20; i++)
  793.         {
  794.             if(gVehicleColors[GetVehicleModel(vehicleid)-400][i] == -1)
  795.             {
  796.                 index = i;
  797.                 break;
  798.             }
  799.         }
  800.         new RandCol = random(index);
  801.         if(isodd(RandCol)) RandCol--;
  802.         if(color1 == -1) vehicleData[vehicleid][gVeh_Color1] = gVehicleColors[GetVehicleModel(vehicleid)-400][RandCol];
  803.         if(color2 == -1) vehicleData[vehicleid][gVeh_Color2] = gVehicleColors[GetVehicleModel(vehicleid)-400][RandCol+1];
  804.         return ChangeVehicleColor(vehicleid, vehicleData[vehicleid][gVeh_Color1], vehicleData[vehicleid][gVeh_Color2]);
  805.     }
  806.     ChangeVehicleColor(vehicleid, color1, color2);
  807.    
  808.     if(paintjob) return 1;
  809.    
  810.     vehicleData[vehicleid][gVeh_Color1] = color1;
  811.     vehicleData[vehicleid][gVeh_Color2] = color2;
  812.     return 1;
  813. }
  814.  
  815. #if defined _ALS_ChangeVehicleColor
  816.     #undef ChangeVehicleColor
  817. #else
  818.     #define _ALS_ChangeVehicleColor
  819. #endif
  820. #define ChangeVehicleColor vfunc_ChangeVehicleColor
  821.  
  822. #define ChangeVehicleColors ChangeVehicleColor
  823. #define ChangeVehicleColour ChangeVehicleColor
  824. #define ChangeVehicleColours ChangeVehicleColor
  825. #define SetVehicleColor ChangeVehicleColor
  826. #define SetVehicleColour ChangeVehicleColor
  827.  
  828. stock vfunc_ChangeVehiclePaintjob(vehicleid, paintjobid)
  829. {
  830.     if(vehicleid < 1 || vehicleid > MAX_VEHICLES) return 0; // Invalid vehicleid
  831.    
  832.     ChangeVehiclePaintjob(vehicleid, paintjobid);
  833.     ChangeVehicleColor(vehicleid, 1, 1, 1);
  834.    
  835.     vehicleData[vehicleid][gVeh_Paintjob] = paintjobid;
  836.    
  837.     if(paintjobid == 3) // Reset colors
  838.     {
  839.         new c1, c2;
  840.         GetVehicleColor(vehicleid, c1, c2);
  841.         SetVehicleColor(vehicleid, c1, c2);
  842.     }
  843.     return 1;
  844. }
  845.  
  846. #if defined _ALS_ChangeVehiclePaintjob
  847.     #undef ChangeVehiclePaintjob
  848. #else
  849.     #define _ALS_ChangeVehiclePaintjob
  850. #endif
  851. #define ChangeVehiclePaintjob vfunc_ChangeVehiclePaintjob
  852.  
  853. #if !defined GetVehiclePaintjob
  854. stock GetVehiclePaintjob(vehicleid)
  855. {
  856.     if(vehicleid < 1 || vehicleid > MAX_VEHICLES) return 0; // Invalid vehicleid
  857.     return vehicleData[vehicleid][gVeh_Paintjob];
  858. }
  859. #endif
  860.  
  861. hook OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  862. {
  863.     // Update paintjob
  864.     vehicleData[vehicleid][gVeh_Paintjob] = paintjobid;
  865.     return 1;
  866. }
  867.  
  868. #define RemoveVehiclePaintjob(%0) ChangeVehiclePaintjob(%0, 3)
  869.  
  870. hook OnVehicleSpawn(vehicleid)
  871. {
  872.     // Reset colours
  873.     vehicleData[vehicleid][gVeh_Paintjob] = 3;
  874.     ChangeVehicleColours(vehicleid, vehicleData[vehicleid][gVeh_SpawnColor1], vehicleData[vehicleid][gVeh_SpawnColor2]);
  875.     return 1;
  876. }
  877.  
  878. hook OnVehicleRespray(playerid, vehicleid, color1, color2)
  879. {
  880.     // Update colours
  881.     vehicleData[vehicleid][gVeh_Color1] = color1;
  882.     vehicleData[vehicleid][gVeh_Color2] = color2;
  883.    
  884.     return 1;
  885. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement