Advertisement
Guest User

Untitled

a guest
May 9th, 2013
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 25.03 KB | None | 0 0
  1. /*
  2. Vehicle functions by Mike (MP2)
  3.  
  4. - Random vehicle colors (-1 in CreateVehicle) are synced between players
  5. - GetVehicleInterior function
  6. - GetVehicleColor function
  7. - ChangeVehicleColor works with -1 (random) colors
  8.  
  9. */
  10.  
  11. #include <YSI\y_hooks>
  12.  
  13. /*
  14. // Fake Natives - Type 'function(' in pawno to show syntax pop-up
  15. native SetVehicleInterior(vehicleid, interior);
  16. native GetVehicleInterior(vehicleid);
  17. native GetVehicleColor(vehicleid, &color1, &color2);
  18. native GetVehicleColour(vehicleid, &color1, &color2);
  19. native GetVehicleColours(vehicleid, &color1, &color2);
  20. native GetVehicleColors(vehicleid, &color1, &color2);
  21. native GetVehiclePaintjob(vehicleid);
  22.  
  23. native IsVehicleModelAircraft(modelid);
  24. native IsVehicleAircraft(vehicleid);
  25.  
  26. native GetVehicleModelType(modelid);
  27. native GetVehicleType(vehicleid);
  28.  
  29. */
  30.  
  31. #define VTYPE_ROAD 0
  32. #define VTYPE_BIKE 1
  33. #define VTYPE_PLANE 2
  34. #define VTYPE_HELI 3
  35. #define VTYPE_BOAT 4
  36. #define VTYPE_TRAIN 5
  37.  
  38. #define VEHICLE_TYPE_ROAD VTYPE_ROAD
  39. #define VEHICLE_TYPE_BIKE VTYPE_BIKE
  40. #define VEHICLE_TYPE_PLANE VTYPE_PLANE
  41. #define VEHICLE_TYPE_HELI VTYPE_HELI
  42. #define VEHICLE_TYPE_BOAT VTYPE_BOAT
  43. #define VEHCLE_TYPE_TRAIN VTYPE_TRAIN
  44.  
  45. forward OnVehicleCreated(vehicleid);
  46.  
  47. #if !defined isodd
  48. #define isodd(%1) \
  49.     ((%1) & 1)
  50. #endif
  51.  
  52. /* ===[SETTINGS]=== */
  53.  
  54. #define CHANGE_V_COLOR_ON_RESPAWN 1 // If set to 0, random vehicle colors (-1) will not change on respawn. 1 will set new random colors on respawn
  55.  
  56. new gVehicleColors[][] = {
  57. {4,1, 123,1, 113,1, 101,1, 75,1, 62,1, 40,1, 36,1, -1}, // Landstalker
  58. {41,41, 47,47, 52,52, 66,66, 74,74, 87,87,91,91, 113,113, -1}, // Bravura
  59. {10,10, 13,13, 22,22, 30,30, 39,39, 90,90, 98,98, 110,110, -1}, // Buffalo
  60. {36,1, 37,1, 30,1, 28,1, 25,1, 40,1, 101,1, 113,1, -1}, // Linerunner
  61. {113,39, 119,50, 123,92, 109,100, 101,101, 95,105, 83,110, 66,25, -1}, // Perennial
  62. {11,1, 24,1, 36,1, 40,1, 75,1, 91,1, 123,1, 4,1, -1}, // Landstalker
  63. {1,1, -1}, // Dumper
  64. {3,1, -1}, // Firetruck
  65. {26,26, -1}, // Trashmaster
  66. {1,1, -1}, // Stretch
  67. {4,1, 9,1, 10,1, 25,1, 36,1, 40,1, 45,1, 84,1, -1}, // Manana
  68. {12,1, 64,1, 123,1, 116,1, 112,1, 106,1, 80,1, 75,1, -1}, // Infernus
  69. {9,1, 10,8, 11,1, 25,8, 27,1, 29,8, 30,1, 37,8, -1}, // Voodoo
  70. {87,1, 88,1, 91,1, 105,1, 109,1, 119,1, 4,1, 25,1, -1}, // Pony
  71. {25,1, 28,1, 43,1, 67,1, 72,1, 9,1, 95,1, 24,1, -1}, // Mule
  72. {20,1, 25,1, 36,1, 40,1, 62,1, 75,1, 92,1, 0,1, -1}, // Cheetah
  73. {1,3, -1}, // Ambulance
  74. {0,0, -1}, // Leviathan
  75. {119,119, 117,227, 114,114, 108,108, 95,95, 81,81, 61,61, 41,41, -1}, // Moonbeam
  76. {45,75, 47,76, 33,75, 13,76, 54,75, 69,76, 59,75, 87,76, -1}, // Esperanto
  77. {6,1, -1}, // Taxi
  78. {4,1, 13,1, 25,1, 30,1, 36,1, 40,1, 75,1, 95,1, -1}, // Washington
  79. {96,25, 97,25, 101,25, 111,31, 113,36, 83,57, 67,59, -1}, // Bobcat
  80. {1,16, 1,56, 1,17, 1,53, 1,5, 1,35, -1}, // Mr.Whoopie/Mr.Whoopee
  81. {1,0, 2,2, 3,2, 3,6, 6,16, 15,30, 24,53, 35,61, -1}, // BF Injection
  82. {43,0, -1}, // Hunter
  83. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Premier
  84. {0,1, -1}, // Enforcer
  85. {4,75, -1}, // Securicar
  86. {12,12, 13,13, 14,14, 1,2, 2,1, 1,3, 3,1, 10,10, -1}, // Banshee
  87. {46,26, -1}, // Predator
  88. {71,59, 75,59, 92,72, 47,74, 55,83, 59,83, 71,87, 82,87, -1}, // Bus
  89. {43,0, -1}, // Rhino
  90. {43,0, -1}, // Barracks
  91. {1,1, 12,12, 2,2, 6,6, 4,4, 46,46, 53,53, -1}, // Hotknife
  92. {1, 1, -1}, // Articulated Trailer 1
  93. {83,1, 87,1, 92,1, 95,1, 109,1, 119,45, 11,1, -1}, // Previon
  94. {54,7, 79,7, 87,7, 95,16, 98,20, 105,20, 123,20, 125,21, -1}, // Coach
  95. {6,76, -1}, // Cabbie
  96. {57,8, 8,17, 43,21, 54,38, 67,8, 37,78, 65,79, 25,78, -1}, // Stallion
  97. {34,34, 32,32, 20,20, 110,110, 66,66, 84,84, 118,118, 121,121, -1}, // Rumpo
  98. {2,96, 79,42, 82,54, 67,86, 126,96, 70,96, 110,54, 67,98, -1}, // RC Bandit
  99. {0,0, 11,105, 25,109, 36,0, 40,36, 75,36, 0,36, 0,109, -1}, // Romero
  100. {4,1, 20,1, 24,1, 25,1, 36,1, 40,1, 54,1, 84,1, -1}, // Packer
  101. {32,36, 32,42, 32,53, 32,66, 32,14, 32,32, -1}, // Monster
  102. {34,34, 35,35, 37,37, 39,39, 41,41, 43,43, 45,45, 47,47, -1}, // Admiral
  103. {-1}, // Squallo - 4 colors two of which can not be changed, will not be synced
  104. {75,2, -1}, // Seasparrow
  105. {3,6, -1}, // Pizzaboy
  106. {1,74, -1}, // Tram
  107. {1,1, -1}, // Articulated Trailer 2 [NO COLORS]
  108. {123,123, 125,125, 36,36, 16,16, 18,18, 46,46, 61,61, 75,75, -1}, // Turismo
  109. {1,3, 1,5, 1,16, 1,22, 1,35, 1,44, 1,53, 1,57, -1}, // Speeder
  110. {56,56, -1}, // Reefer
  111. {26,26, -1}, // Tropic
  112. {84,15, 84,58, 84,31, 32,74, 43,31, 1,31, 77,31, 32,74, -1}, // Flatbed
  113. {84,63, 91,63, 102,65, 105,72, 110,93, 121,93, 12,95, 23,1, -1}, // Yankee
  114. {58,1, 2,1, 63,1, 18,1, 32,1, 45,1, 13,1, 34,1, -1}, // Caddy
  115. {91,1, 101,1, 109,1, 113,1, 4,1, 25,1, 30,1, 36,1, -1}, // Solair
  116. {26,26, 28,28, 44,44, 51,51, 57,57, 72,72, 106,106, 112,112, -1}, // Berkley's RC Van (Topfun)
  117. {1,3, 1,9, 1,18, 1,30, 17,23, 46,23, 46,32, 57,34, -1}, // Skimmer
  118. {36,1, 37,1, 43,1, 53,1, 61,1, 75,1, 79,1, 88,1, -1}, // PCJ-600
  119. {12,12, 13,13, 14,14, 1,2, 2,1, 1,3, 3,1, 10,10, -1}, // Faggio
  120. {79,79, 84,84, 7,7, 11,11, 19,19, 22,22, 36,36, 53,53, -1}, // Freeway
  121. {14,75, -1}, // RC Baron
  122. {14,75, -1}, // RC Raider
  123. {67,76, 68,76, 78,76, 2,76, 16,76, 18,76, 25,76, 45,88, -1}, // Glendale
  124. {51,1, 58,8, 60,1, 68,8, 2,1, 13,8, 22,1, 36,8, -1}, // Oceanic
  125. {6,6, 46,46, 53,53, 3,3, -1}, // Sanchez
  126. {1,3, -1}, // Sparrow
  127. {43,0, -1}, // Patriot
  128. {120,117, 103,111, 120,114, 74,91, 120,112, 74,83, 120,113, 66,71, -1}, // Quad
  129. {56,15, 56,53, -1}, // Coastguard
  130. {56,15, 56,53, -1}, // Dinghy
  131. {97,1, 81,1, 105,1, 110,1, 91,1, 74,1, 84,1, 83,1, -1}, // Hermes
  132. {2,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29, -1}, // Sabre
  133. {6,7, 7,6, 1,6, 89,91, 119,117, 103,102, 77,87, 71,77, -1}, // Rustler
  134. {92,1, 94,1, 101,1, 121,1, 0,1, 22,1, 36,1, 75,1, -1}, // ZR-350
  135. {72,1, 66,1, 59,1, 45,1, 40,1, 39,1, 35,1, 20,1, -1}, // Walton
  136. {27,36, 59,36, 60,35, 55,41, 54,31, 49,23, 45,32, 40,29, -1}, // Regina
  137. {73,45, 12,12, 2,2, 6,6, 4,4, 46,46, 53,53, -1}, // Comet
  138. {1,1, 3,3, 6,6, 46,46, 65,9, 14,1, 12,9, 26,1, -1}, // BMX
  139. {41,41, 48,48, 52,52, 64,64, 71,71, 85,85, 10,10, 62,62, -1}, // Burrito
  140. {-1}, // Camper [4 colors - can not be synced]
  141. {12,35, 50,32, 40,26, 66,36, -1}, // Marquis
  142. {1,73, 1,74, 1,75, 1,76, 1,77, 1,78, 1,79, -1}, // Baggage
  143. {1,1, -1}, // Dozer
  144. {26,14, 29,42, 26,57, 54,29, 26,3, 3,29, 12,39, 74,35, -1}, // Maverick
  145. {2,26, 2,29, -1}, // News Macerick/News Helicopter
  146. {13,118, 14,123, 120,123, 112,120, 84,110, 76,102, -1}, // Rancher
  147. {0,0, -1}, // FBI Rancher
  148. {40,65, 71,72, 52,66, 64,72, 30,72, 60,72, -1}, // Virgo
  149. {30,26, 77,26, 81,27, 24,55, 28,56, 49,59, 52,69, 71,107, -1}, // Greenwood
  150. {36,13, -1}, // Jetmax
  151. {36,117, 36,13, 42,30, 42,33, 54,36, 75,79, 92,101, 98,109, -1}, // Hotring Racer
  152. {123,124, 119,122, 118,117, 116,115, 114,108, 101,106, 88,99, 5,6, -1}, // Sandking
  153. {74,72, 66,72, 53,56, 37,19, 22,22, 20,20, 9,14, 0,0, -1}, // Blista Compact
  154. {0,1, -1}, // Police Maverick/Police Helicopter
  155. {11,123, 13,120, 20,117, 24,112, 27,107, 36,105, 37,107, 43,93, -1}, // Boxville
  156. {109,25, 109,32, 112,32, 10,32, 30,44, 32,52, 84,66, 84,69, -1}, // Benson
  157. {75,84, 40,84, 40,110, 28,119, 25,119, 21,119, 13,119, 4,119, -1}, // Mesa
  158. {14,75, -1}, // RC Goblin
  159. {7,94, 36,88, 51,75, 53,75 ,58,67, 75,67, 75,61, 79,62, -1}, // Hotring Racer A
  160. {83,66, 87,74, 87,75, 98,83, 101,100, 103,101, 117,116, 123,36, -1}, // Hotring Racer B
  161. {51,39, 57,38, 45,29, 34,9, 65,9, 14,1, 12,9, 26,1, -1}, // Bloodring Banger
  162. {13,118, 14,123, 120,123, 112,120, 84,110, 76,102, -1}, // Rancher (LURE)
  163. {3,3, 6,6, 7,7, 52,52, 76,76, -1}, // Super GT
  164. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Elegant
  165. {1,1, -1}, // Journey
  166. {7,1, 74,1, 61,1, 16,1, 25,1, 30,1, 36,1, 53,1, -1}, // Bike
  167. {43,43, 46,46, 39,39, 28,28, 16,16, 6,6, 5,5, 2,2, -1}, // Mountain Bike
  168. {3,90, 4,90, 7,68, 8,66, 12,60, 27,97, 34,51, 37,51, -1}, // Beagle
  169. {17,39, 15,123, 32,112, 45,88, 52,71, 57,67, 61,96, 96,96, -1}, // Cropduster
  170. {38,51, 21,36, 21,34, 30,34, 54,34, 55,20, 48,18, 51,6, -1}, // Stuntplane
  171. {10,1, 25,1, 28,1, 36,1, 40,1, 54,1, 75,1, 113,1, -1}, // Tanker
  172. {13,76, 24,77, 63,78, 42,76, 54,77, 39,78, 11,76, 62,77, -1}, // Roadtrain
  173. {116,1, 119,1, 122,1, 4,1, 9,1, 24,1, 27,1, 36,1, -1}, // Nebula
  174. {37,36, 36,36, 40,36, 43,41, 47,41, 51,72, 54,75, 55,84, -1}, // Majestic
  175. {2,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29, -1}, // Buccaneer
  176. {1,1, -1}, // Shamal
  177. {-1}, // Hydra [NO DATA FOUND]
  178. {74,74, 75,13, 87,118, 92,3, 115,118, 25,118, 36,0, 118,118, -1}, // FCR-900
  179. {3,3, 3,8, 6,25, 7,79, 8,82, 36,105, 39,106, 51,118, -1}, // NRG-500
  180. {-1}, // Cop Bike [NO DATA FOUND]
  181. {-1}, // Cement [4 colors - not synced]
  182. {1,1, 17,20, 18,20, 22,30, 36,43, 44,51, 52,54, -1}, // Towtruck
  183. {2,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29, -1}, // Fortune
  184. {52,1, 53,1, 66,1, 75,1, 76,1, 81,1, 95,1, 109,1, -1}, // Cadrona
  185. {-1}, // FBI Truck [ NO DATA FOUND]
  186. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Willard
  187. {110,1, 111,1, 112,1, 114,1, 119,1, 122,1, 4,1, 13,1, -1}, // Forklift
  188. {2,35, 36,2, 51,53, 91,2, 11,22, 40,35, -1}, // Tractor
  189. {-1}, // Combine [NO DATA FOUND]
  190. {73,1, 74,1, 75,1, 77,1, 79,1, 83,1, 84,1, 91,1, -1}, // Feltzer
  191. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Remington
  192. {3,1, 28,1, 31,1, 55,1, 66,1, 97,1, 123,1, 118,1, -1}, // Slamvan
  193. {9,1, 12,1, 26,96, 30,96, 32,1, 37,1, 57,96, 71,96, -1}, // Blade
  194. {1,1, -1}, // Freight
  195. {1,1, -1}, // Streak
  196. {96,67, 86,70, 79,74, 70,86, 61,98, 75,75, 75,91, -1}, // Vortex
  197. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Vincent
  198. {51,1, 58,8, 60,1, 68,8, 2,1, 13,8, 22,1, 36,8, -1}, // Bullet
  199. {13,118, 24,118, 31,93, 32,92, 45,92, 113,92, 119,113, 122,113, -1}, // Clover
  200. {76,8, 32,8, 43,8, 67,8, 11,11, 8,90, 2,2, 83,13, -1}, // Sadler
  201. {3,1, -1}, // Firetruck LA (Ladder Truck)
  202. {50,1, 47,1, 44,96, 40,96, 39,1, 30,1, 28,96, 9,96, -1}, // Hustler
  203. {62,37, 78,38, 2,62, 3,87, 2,78, 113,78, 119,62, 7,78, -1}, // Intruder
  204. {122,1, 123,1, 125,1, 10,1, 24,1, 37,1, 55,1, 66,1, -1}, // Primo
  205. {1,1, -1}, // Cargobob
  206. {74,39, 72,39, 75,39, 79,39, 83,36, 84,36, 89,35, 91,35, -1}, // Tampa
  207. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Sunrise
  208. {67,1, 72,1, 75,1, 83,1, 91,1, 101,1, 109,1, 20,1, -1}, // Merit
  209. {56,56, 49,49, 26,124, -1}, // Utility
  210. {38,9, 55,23, 61,74, 71,87, 91,87, 98,114, 102,119, 111,3, -1}, // Nevada
  211. {53,32, 15,32, 45,32, 34,30, 65,32, 14,32, 12,32, 43,32, -1}, // Yosemite
  212. {51,1, 58,1, 60,1, 68,1, 2,1, 13,1, 22,1, 36,1, -1}, // Windsor
  213. {1,1, -1}, // Monster A
  214. {1,1, -1}, // Monster B
  215. {112,1, 116,1, 117,1, 24,1, 30,1, 35,1, 36,1, 40,1, -1}, // Uranus
  216. {51,1, 58,8, 60,1, 68,8, 2,1, 13,8, 22,1, 36,8, -1}, // Jester
  217. {52,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29, -1}, // Sultan
  218. {57,8, 8,17, 43,21, 54,38, 67,8, 37,78, 65,79, 25,78, -1}, // Stratum
  219. {36,1, 35,1, 17,1, 11,1, 116,1, 113,1, 101,1, 92,1, -1}, // Elegy
  220. {1,6, -1}, // Raindance
  221. {-1}, // RC Tiger [NO DATA FOUND]
  222. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Flash
  223. {109,1, 30,8, 95,1, 84,8, 83,1, 72,8, 71,1, 52,8, -1}, // Tahoma
  224. {97,96, 88,64, 90,96, 93,64, 97,96, 99,81, 102,114, 114,1, -1}, // Savanna
  225. {2,39, 9,39, 17,1, 21,1, 33,0, 37,0, 41,29, 56,29, -1}, // Bandito
  226. {1,1, -1}, // Freight Flat Carriage
  227. {1,1, -1}, // Streak Carriage
  228. {2,35, 36,2, 51,53, 91,2, 11,22, 40,35, -1}, // Kart
  229. {94,1, 101,1, 116,1, 117,1, 4,1, 25,1, 30,1, 37,1, -1}, // Mower
  230. {91,38, 115,43, 85,6, 79,7, 78,8, 77,18, 79,18, 86,24, -1}, // Duneride
  231. {26,26, -1}, // Sweeper
  232. {12,1, 19,96, 31,64, 25,96, 38,1, 51,96, 57,1, 66,96, -1}, // Broadway
  233. {67,1, 68,96, 72,1, 74,8, 75,96, 76,8, 79,1, 84,96, -1}, // Tornado
  234. {1,3, 8,7, 8,10, 8,16, 23,31, 40,44, -1}, // AT-400
  235. {1,1, -1}, // DFT-30
  236. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Huntley
  237. {92,92, 81,81, 67,67, 66,66, 61,61, 53,53, 51,51, 47,47, 43,43, -1}, // Stafford
  238. {54,1, 58,1, 66,1, 72,1, 75,1, 87,1, 101,1, 36,1, -1}, // BF-400
  239. {41,10, 41,20, 49,11, 56,123, 110,113, 112,116, 114,118, 119,101, -1}, // Newsvan/news Van
  240. {1,1, -1}, // Tug
  241. {1,1, -1}, // Petrol Trailer
  242. {37,37, 42,42, 53,53, 62,62, 7,7, 10,10, 11,11, 15,15, -1}, // Emperor
  243. {119,1, 122,1, 8,1, 10,1, 13,1, 25,1, 27,1, 32,1, -1}, // Wayfarer
  244. {36,1, 40,1, 43,1, 53,1, 72,1, 75,1, 95,1, 101,1, -1}, // Euros
  245. {1,1, -1}, // Hotdog
  246. {37,37, 31,31, 23,23, 22,22, 7,7, 124,124, 114,114, 112,112, -1}, // Club
  247. {-1}, // Freight Box Carriage [NO DATA FOUND]
  248. {1,1, -1}, // Articulated Trailer 3
  249. {1,1, -1}, // Andromada
  250. {51,1, 58,8, 60,1, 68,8, 2,1, 13,8, 22,1, 36,8, -1}, // Dodo
  251. {-1}, // RC Cam [NO DATA FOUND]
  252. {112,20, -1}, // Launch
  253. {0,1, -1}, // Cop Car LSPD
  254. {0,1, -1}, // Cop Car SFPD
  255. {0,1, -1}, // Cop Car LVPD
  256. {0,1, -1}, // Cop Car Ranger (Police Ranger)
  257. {81,8, 32,8, 43,8, 67,8, 11,11, 8,90, 2,2, 83,13, -1}, // Picador
  258. {1,1, -1}, // Swatvan S.W.A.T Van
  259. {58,1, 69,1, 75,77, 18,1, 32,1, 45,45, 13,1, 34,1, -1}, // Alpha
  260. {58,1, 69,1, 75,77, 18,1, 32,1, 45,45, 13,1, 34,1, -1}, // Phoenix
  261. {67,76, 68,76, 78,76, 2,76, 16,76, 18,76, 25,76, 45,88, -1}, // Glendale Shit
  262. {61,8, 32,8, 43,8, 67,8, 11,11, 8,90, 2,2, 83,13, -1}, // Sadler Shit
  263. {-1}, // Baggage Box A [NO DATA FOUND]
  264. {-1}, // Baggage Box B [NO DATA FOUND]
  265. {1,1, -1}, // Tug Stairs
  266. {36,36, -1}, // Burglary Boxville
  267. {-1}, // Farm Plow Trailer [NO DATA FOUND]
  268. {-1} // Utility Trailer [NO DATA FOUND]
  269. };
  270.  
  271. new stock const VFUNC_vTypeArray[] = {
  272. VTYPE_ROAD, // Landstalker
  273. VTYPE_ROAD, // Bravura
  274. VTYPE_ROAD, // Buffalo
  275. VTYPE_ROAD, // Linerunner
  276. VTYPE_ROAD, // Perenniel
  277. VTYPE_ROAD, // Sentinel
  278. VTYPE_ROAD, // Dumper
  279. VTYPE_ROAD, // Firetruck
  280. VTYPE_ROAD, // Trashmaster
  281. VTYPE_ROAD, // Stretch
  282. VTYPE_ROAD, // Manana
  283. VTYPE_ROAD, // Infernus
  284. VTYPE_ROAD, // Voodoo
  285. VTYPE_ROAD, // Pony
  286. VTYPE_ROAD, // Mule
  287. VTYPE_ROAD, // Cheetah
  288. VTYPE_ROAD, // Ambulance
  289. VTYPE_HELI, // Leviathan
  290. VTYPE_ROAD, // Moonbeam
  291. VTYPE_ROAD, // Esperanto
  292. VTYPE_ROAD, // Taxi
  293. VTYPE_ROAD, // Washington
  294. VTYPE_ROAD, // Bobcat
  295. VTYPE_ROAD, // Mr Whoopee (Ice-Cream Truck)
  296. VTYPE_ROAD, // BF Injection
  297. VTYPE_HELI, // Hunter
  298. VTYPE_ROAD, // Permier
  299. VTYPE_ROAD, // Enforcer
  300. VTYPE_ROAD, // Securicar
  301. VTYPE_ROAD, // Banshee
  302. VTYPE_BOAT, // Predator
  303. VTYPE_ROAD, // Bus
  304. VTYPE_ROAD, // Rhino
  305. VTYPE_ROAD, // Barracks
  306. VTYPE_ROAD, // Hotknife
  307. VTYPE_ROAD, // Articulated Trailer 1
  308. VTYPE_ROAD, // Previon
  309. VTYPE_ROAD, // Coach
  310. VTYPE_ROAD, // Cab
  311. VTYPE_ROAD, // Stallion
  312. VTYPE_ROAD, // Rumpo
  313. VTYPE_ROAD, // RC Bandit
  314. VTYPE_ROAD, // Romero
  315. VTYPE_ROAD, // Packer
  316. VTYPE_ROAD, // Monster
  317. VTYPE_ROAD, // Admiral
  318. VTYPE_BOAT, // Squallo
  319. VTYPE_HELI, // Seasparrow
  320. VTYPE_BIKE, // Pizzaboy
  321. VTYPE_ROAD, // Tram
  322. VTYPE_ROAD, // Art Trailer 2
  323. VTYPE_ROAD, // Turismo
  324. VTYPE_BOAT, // Speeder
  325. VTYPE_BOAT, // Reefer
  326. VTYPE_BOAT, // Tropic
  327. VTYPE_ROAD, // Flatbed
  328. VTYPE_ROAD, // Yankee
  329. VTYPE_ROAD, // Caddy
  330. VTYPE_ROAD, // Solair
  331. VTYPE_ROAD, // Topfun
  332. VTYPE_PLANE, // Skimmer
  333. VTYPE_BIKE, // PCJ-600
  334. VTYPE_BIKE, // Faggio
  335. VTYPE_BIKE, // Freeway
  336. VTYPE_PLANE, // RC Baron
  337. VTYPE_HELI, // RC Raider
  338. VTYPE_ROAD, // Glendale
  339. VTYPE_ROAD, // Oceanic
  340. VTYPE_BIKE, // Sanchez
  341. VTYPE_HELI, // Sparrow
  342. VTYPE_ROAD, // Patriot
  343. VTYPE_ROAD, // Quad
  344. VTYPE_BOAT, // Coastguard
  345. VTYPE_BOAT, // Dinghy
  346. VTYPE_ROAD, // Hermes
  347. VTYPE_ROAD, // Sasbre
  348. VTYPE_PLANE, // Rustler
  349. VTYPE_ROAD, // ZR-350
  350. VTYPE_ROAD, // Walton
  351. VTYPE_ROAD, // Regina
  352. VTYPE_ROAD, // Comet
  353. VTYPE_BIKE, // BMX
  354. VTYPE_ROAD, // Burrito
  355. VTYPE_ROAD, // Camper
  356. VTYPE_BOAT, // Marquis
  357. VTYPE_ROAD, // Baggage
  358. VTYPE_ROAD, // Dozer
  359. VTYPE_HELI, // Maverick
  360. VTYPE_HELI, // News Heli
  361. VTYPE_ROAD, // Rancher
  362. VTYPE_ROAD, // FBI Rancher
  363. VTYPE_ROAD, // Virgo
  364. VTYPE_ROAD, // Greenwood
  365. VTYPE_BOAT, // Jetmax
  366. VTYPE_ROAD, // Hotring
  367. VTYPE_ROAD, // Sandking
  368. VTYPE_ROAD, // Blista Compact
  369. VTYPE_HELI, // Police Maverick (polmav)
  370. VTYPE_ROAD, // Boxville
  371. VTYPE_ROAD, // Benson
  372. VTYPE_ROAD, // Mesa
  373. VTYPE_HELI, // RC Goblin
  374. VTYPE_ROAD, // Hotring
  375. VTYPE_ROAD, // Hotring
  376. VTYPE_ROAD, // Bloodring Bander
  377. VTYPE_ROAD, // Rancher
  378. VTYPE_ROAD, // Super GT
  379. VTYPE_ROAD, // Elegant
  380. VTYPE_ROAD, // Journey
  381. VTYPE_BIKE, // Bike
  382. VTYPE_BIKE, // Mountain Bike
  383. VTYPE_PLANE, // Beagle
  384. VTYPE_PLANE, // Cropduster
  385. VTYPE_PLANE, // Stuntplane
  386. VTYPE_ROAD, // Tanker
  387. VTYPE_ROAD, // Roadtrain
  388. VTYPE_ROAD, // Nebula
  389. VTYPE_ROAD, // Majestic
  390. VTYPE_ROAD, // Buccaneer
  391. VTYPE_PLANE, // Shamal
  392. VTYPE_PLANE, // Hydra
  393. VTYPE_BIKE, // FCR-900
  394. VTYPE_BIKE, // NRG-500
  395. VTYPE_BIKE, // HPV (Cop Bike)
  396. VTYPE_ROAD, // Cement
  397. VTYPE_ROAD, // Towtruck
  398. VTYPE_ROAD, // Fortune
  399. VTYPE_ROAD, // Cadrona
  400. VTYPE_ROAD, // FBI Truck
  401. VTYPE_ROAD, // Willard
  402. VTYPE_ROAD, // Forklift
  403. VTYPE_ROAD, // Tractor
  404. VTYPE_ROAD, // Combine
  405. VTYPE_ROAD, // Feltzer
  406. VTYPE_ROAD, // Remington
  407. VTYPE_ROAD, // Slamvan
  408. VTYPE_ROAD, // Blade
  409. VTYPE_TRAIN, // Freight
  410. VTYPE_TRAIN, // Brownstreak
  411. VTYPE_ROAD, // Vortex
  412. VTYPE_ROAD, // Vincent
  413. VTYPE_ROAD, // Bullet
  414. VTYPE_ROAD, // Clover
  415. VTYPE_ROAD, // Sadler
  416. VTYPE_ROAD, // Firetruck
  417. VTYPE_ROAD, // Hustler
  418. VTYPE_ROAD, // Intruder
  419. VTYPE_ROAD, // Primo
  420. VTYPE_HELI, // Cargobob
  421. VTYPE_ROAD, // Tampa
  422. VTYPE_ROAD, // Sunrise
  423. VTYPE_ROAD, // Merit
  424. VTYPE_ROAD, // Utility
  425. VTYPE_PLANE, // Nevada
  426. VTYPE_ROAD, // Yosemite
  427. VTYPE_ROAD, // Windsor
  428. VTYPE_ROAD, // Monster
  429. VTYPE_ROAD, // Monster
  430. VTYPE_ROAD, // Uranus
  431. VTYPE_ROAD, // Jester
  432. VTYPE_ROAD, // Sultan
  433. VTYPE_ROAD, // Stratum
  434. VTYPE_ROAD, // Elegy
  435. VTYPE_HELI, // Raindance
  436. VTYPE_ROAD, // RC Tiger
  437. VTYPE_ROAD, // Flash
  438. VTYPE_ROAD, // Tahoma
  439. VTYPE_ROAD, // Savanna
  440. VTYPE_ROAD, // Bandito
  441. VTYPE_TRAIN, // Carriage
  442. VTYPE_TRAIN, // Carriage
  443. VTYPE_ROAD, // Kart
  444. VTYPE_ROAD, // Mower
  445. VTYPE_ROAD, // Done
  446. VTYPE_ROAD, // Sweeper
  447. VTYPE_ROAD, // Broadway
  448. VTYPE_ROAD, // Tornado
  449. VTYPE_PLANE, // AT-400
  450. VTYPE_ROAD, // DFT-30
  451. VTYPE_ROAD, // Huntley
  452. VTYPE_ROAD, // Stafford
  453. VTYPE_BIKE, // BF-400
  454. VTYPE_ROAD, // Newsvan
  455. VTYPE_ROAD, // Tug
  456. VTYPE_ROAD, // Petrol Trailer
  457. VTYPE_ROAD, // Emperor
  458. VTYPE_BIKE, // Wayfarer
  459. VTYPE_ROAD, // Euros
  460. VTYPE_ROAD, // Hotdog
  461. VTYPE_ROAD, // Club
  462. VTYPE_TRAIN, // Freight Box Trailer
  463. VTYPE_ROAD, // Artic Trailer
  464. VTYPE_PLANE, // Androm
  465. VTYPE_PLANE, // Dodo
  466. VTYPE_ROAD, // RC Cam
  467. VTYPE_BOAT, // Launch
  468. VTYPE_ROAD, // LSPD
  469. VTYPE_ROAD, // SFPD
  470. VTYPE_ROAD, // LVPD
  471. VTYPE_ROAD, // Police Ranger
  472. VTYPE_ROAD, // Picador
  473. VTYPE_ROAD, // S.W.A.T
  474. VTYPE_ROAD, // Alpha
  475. VTYPE_ROAD, // Phoenix
  476. VTYPE_ROAD, // Glendale Shit
  477. VTYPE_ROAD, // Sadler Shit
  478. VTYPE_ROAD, // Baggage
  479. VTYPE_ROAD, // Baggage
  480. VTYPE_ROAD, // Stairs
  481. VTYPE_ROAD, // Boxville
  482. VTYPE_ROAD, // Plow
  483. VTYPE_ROAD // Utility Trailer
  484. };
  485.  
  486. // Functions for vehicle types
  487.  
  488. #define IsVehicleModelAircraft(%0) (VFUNC_vTypeArray[%0-400] == VTYPE_PLANE || VFUNC_vTypeArray[%0-400] == VTYPE_HELI)
  489. #define IsVehicleAircraft(%0) (VFUNC_vTypeArray[GetVehicleModel(%0)-400] == VTYPE_PLANE || VFUNC_vTypeArray[GetVehicleModel(%0)-400] == VTYPE_HELI)
  490.  
  491.  
  492. #define GetVehicleModelType(%0) VFUNC_vTypeArray[%0-400]
  493. #define GetVehicleType(%0) VFUNC_vTypeArray[GetVehicleModel(%0)-400]
  494.  
  495.  
  496. enum VFUNC_VDATA_ENUM
  497. {
  498.     gVeh_Interior,
  499.     gVeh_Color1,
  500.     gVeh_Color2,
  501.     gVeh_SpawnColor1,
  502.     gVeh_SpawnColor2,
  503.     gVeh_Paintjob
  504. }
  505.  
  506. new vehicleData[MAX_VEHICLES+1][VFUNC_VDATA_ENUM];
  507.  
  508. stock vfunc_CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, interior=0)
  509. {
  510.     if(modelid < 400 || modelid > 610) return 0; // Invalid model
  511.    
  512.     if(modelid == 569 || modelid == 570 || modelid == 537 || modelid == 538) // Trains, use AddStaticVehicle
  513.     {
  514.         new vid = AddStaticVehicle(modelid, x, y, z, rotation, color1, color2);
  515.         return vid;
  516.     }
  517.    
  518.     new c1 = color1, c2 = color2;
  519.  
  520.     if((color1 == -1 || color2 == -1) && gVehicleColors[modelid-400][0] != -1) // Random colors, yay!
  521.     {
  522.         // Get the max index
  523.         new index;
  524.         for(new i=0; i<20; i++)
  525.         {
  526.             if(gVehicleColors[modelid-400][i] == -1)
  527.             {
  528.                 index = i;
  529.                 break;
  530.             }
  531.         }
  532.         new RandCol = random(index);
  533.         if(isodd(RandCol)) RandCol--;
  534.         if(color1 == -1) c1 = gVehicleColors[modelid-400][RandCol];
  535.         if(color2 == -1) c2 = gVehicleColors[modelid-400][RandCol+1];
  536.     }
  537.     new vid = CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:rotation, c1, c2, respawn_delay);
  538.    
  539.     vehicleData[vid][gVeh_Interior] = interior;
  540.     vehicleData[vid][gVeh_Color1] = c1;
  541.     vehicleData[vid][gVeh_Color2] = c2;
  542.    
  543.     #if CHANGE_V_COLOR_ON_RESPAWN == 1
  544.     vehicleData[vid][gVeh_SpawnColor1] = color1;
  545.     vehicleData[vid][gVeh_SpawnColor2] = color2;
  546.     #else
  547.     vehicleData[vid][gVeh_SpawnColor1] = c1;
  548.     vehicleData[vid][gVeh_SpawnColor2] = c2;
  549.     #endif
  550.    
  551.     vehicleData[vid][gVeh_Paintjob] = 3;
  552.    
  553.     CallRemoteFunction("OnVehicleCreated", "i", vid);
  554.     return vid;
  555. }
  556.  
  557. #if defined _ALS_CreateVehicle
  558.     #undef CreateVehicle
  559. #else
  560.     #define _ALS_CreateVehicle
  561. #endif
  562. #define CreateVehicle vfunc_CreateVehicle
  563.  
  564. stock vfunc_AddStaticVehicle(modelid, Float:x, Float:y, Float:z, Float:rotation, color1, color2) return vfunc_CreateVehicle(modelid, x, y, z, rotation, color1, color2, -1, 0);
  565. #if defined _ALS_AddStaticVehicle
  566.     #undef AddStaticVehicle
  567. #else
  568.     #define _ALS_AddStaticVehicle
  569. #endif
  570. #define AddStaticVehicle vfunc_AddStaticVehicle
  571.  
  572. stock vfunc_AddStaticVehicleEx(modelid, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay) return vfunc_CreateVehicle(modelid, x, y, z, rotation, color1, color2, respawn_delay, 0);
  573. #if defined _ALS_AddStaticVehicleEx
  574.     #undef AddStaticVehicleEx
  575. #else
  576.     #define _ALS_AddStaticVehicleEx
  577. #endif
  578. #define AddStaticVehicleEx vfunc_AddStaticVehicleEx
  579.  
  580. stock vfunc_LinkVehicleToInterior(vehicleid, interior)
  581. {
  582.     if(vehicleid < 1 || vehicleid > MAX_VEHICLES) return 0; // Invalid vehicleid
  583.     vehicleData[vehicleid][gVeh_Interior] = interior;
  584.     return LinkVehicleToInterior(vehicleid, interior);
  585. }
  586.  
  587. #if defined _ALS_LinkVehicleToInterior
  588.     #undef LinkVehicleToInterior
  589. #else
  590.     #define _ALS_LinkVehicleToInterior
  591. #endif
  592. #define LinkVehicleToInterior vfunc_LinkVehicleToInterior
  593.  
  594. #if !defined SetVehicleInterior
  595. #define SetVehicleInterior LinkVehicleToInterior
  596. #endif
  597.  
  598. stock GetVehicleInterior(vehicleid)
  599. {
  600.     if(vehicleid < 1 || vehicleid > MAX_VEHICLES) return 0; // Invalid vehicleid
  601.     return vehicleData[vehicleid][gVeh_Interior];
  602. }
  603.  
  604. stock GetVehicleColor(vehicleid, &color1, &color2)
  605. {
  606.     if(vehicleid < 1 || vehicleid > MAX_VEHICLES) return 0; // Invalid vehicleid
  607.     color1 = vehicleData[vehicleid][gVeh_Color1];
  608.     color2 = vehicleData[vehicleid][gVeh_Color2];
  609.     return vehicleData[vehicleid][gVeh_Color1];
  610. }
  611. #define GetVehicleColors GetVehicleColor
  612. #define GetVehicleColours GetVehicleColor
  613. #define GetVehicleColour GetVehicleColor
  614.  
  615.  
  616. stock vfunc_ChangeVehicleColor(vehicleid, color1, color2, paintjob=0)
  617. {
  618.     if(vehicleid < 1 || vehicleid > MAX_VEHICLES) return 0; // Invalid vehicleid
  619.    
  620.     if((color1 == -1 || color2 == -1) && gVehicleColors[GetVehicleModel(vehicleid)-400][0] != -1) // Random colors, yay!
  621.     {
  622.         // Get the max index
  623.         new index;
  624.         for(new i=0; i<20; i++)
  625.         {
  626.             if(gVehicleColors[GetVehicleModel(vehicleid)-400][i] == -1)
  627.             {
  628.                 index = i;
  629.                 break;
  630.             }
  631.         }
  632.         new RandCol = random(index);
  633.         if(isodd(RandCol)) RandCol--;
  634.         if(color1 == -1) vehicleData[vehicleid][gVeh_Color1] = gVehicleColors[GetVehicleModel(vehicleid)-400][RandCol];
  635.         if(color2 == -1) vehicleData[vehicleid][gVeh_Color2] = gVehicleColors[GetVehicleModel(vehicleid)-400][RandCol+1];
  636.         return ChangeVehicleColor(vehicleid, vehicleData[vehicleid][gVeh_Color1], vehicleData[vehicleid][gVeh_Color2]);
  637.     }
  638.     ChangeVehicleColor(vehicleid, color1, color2);
  639.    
  640.     if(paintjob) return 1;
  641.    
  642.     vehicleData[vehicleid][gVeh_Color1] = color1;
  643.     vehicleData[vehicleid][gVeh_Color2] = color2;
  644.     return 1;
  645. }
  646.  
  647. #if defined _ALS_ChangeVehicleColor
  648.     #undef ChangeVehicleColor
  649. #else
  650.     #define _ALS_ChangeVehicleColor
  651. #endif
  652. #define ChangeVehicleColor vfunc_ChangeVehicleColor
  653.  
  654. #define ChangeVehicleColors ChangeVehicleColor
  655. #define ChangeVehicleColour ChangeVehicleColor
  656. #define ChangeVehicleColours ChangeVehicleColor
  657. #define SetVehicleColor ChangeVehicleColor
  658. #define SetVehicleColour ChangeVehicleColor
  659.  
  660. stock vfunc_ChangeVehiclePaintjob(vehicleid, paintjobid)
  661. {
  662.     if(vehicleid < 1 || vehicleid > MAX_VEHICLES) return 0; // Invalid vehicleid
  663.    
  664.     ChangeVehiclePaintjob(vehicleid, paintjobid);
  665.     ChangeVehicleColor(vehicleid, 1, 1, 1);
  666.    
  667.     vehicleData[vehicleid][gVeh_Paintjob] = paintjobid;
  668.    
  669.     if(paintjobid == 3) // Reset colors
  670.     {
  671.         new c1, c2;
  672.         GetVehicleColor(vehicleid, c1, c2);
  673.         SetVehicleColor(vehicleid, c1, c2);
  674.     }
  675.     return 1;
  676. }
  677.  
  678. #if defined _ALS_ChangeVehiclePaintjob
  679.     #undef ChangeVehiclePaintjob
  680. #else
  681.     #define _ALS_ChangeVehiclePaintjob
  682. #endif
  683. #define ChangeVehiclePaintjob vfunc_ChangeVehiclePaintjob
  684.  
  685. stock GetVehiclePaintjob(vehicleid)
  686. {
  687.     if(vehicleid < 1 || vehicleid > MAX_VEHICLES) return 0; // Invalid vehicleid
  688.     return vehicleData[vehicleid][gVeh_Paintjob];
  689. }
  690.  
  691. hook OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  692. {
  693.     vehicleData[vehicleid][gVeh_Paintjob] = paintjobid;
  694.     return 1;
  695. }
  696.  
  697. #define RemoveVehiclePaintjob(%0) ChangeVehiclePaintjob(%0, 3)
  698.  
  699. hook OnVehicleSpawn(vehicleid)
  700. {
  701.     vehicleData[vehicleid][gVeh_Paintjob] = 3;
  702.     ChangeVehicleColours(vehicleid, vehicleData[vehicleid][gVeh_SpawnColor1], vehicleData[vehicleid][gVeh_SpawnColor2]);
  703.     return 1;
  704. }
  705.  
  706. hook OnVehicleRespray(playerid, vehicleid, color1, color2)
  707. {
  708.     vehicleData[vehicleid][gVeh_Color1] = color1;
  709.     vehicleData[vehicleid][gVeh_Color2] = color2;
  710.    
  711.     return 1;
  712. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement