Advertisement
Guest User

Max upgrade.lua

a guest
May 23rd, 2015
956
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.75 KB | None | 0 0
  1. --[[ a large list of mod and color codes can be found at
  2. 7http://www.nextgenupdate.com/forums/grand-theft-auto-v-modding/766645-rpc-resource-vehicle-editing-natives-addresses-bles-1-16
  3.  
  4. -a-2.html
  5. index color numbers can be found at http://gtaforums.com/topic/788275-models-color-hashes/?p=1067393998
  6. ]]--
  7. local car ={}
  8.  
  9. local function inTable(tbl, item)
  10. for key, value in pairs(tbl) do
  11. if value == item then return true end
  12. end
  13. return false
  14. end
  15.  
  16. local function repairVeh(int)
  17. VEHICLE.SET_VEHICLE_FIXED(int)
  18. --Clean the car - dirtLvl = 0 (clean) to 15 (dirty)
  19. VEHICLE.SET_VEHICLE_DIRT_LEVEL(int, 0)
  20. --Lets make our car "not wanted" anymore as well
  21. VEHICLE.SET_VEHICLE_IS_WANTED(int, false)
  22. return
  23. end
  24.  
  25. local function setWheels(int)
  26. local sport = {0, 3, 1, 5, 6, 7}
  27. local offroad = {9, 11, 12}
  28. local suv = {2, 4}
  29. --Wheel Type 0: Sport, 1: Muscle, 2: Lowrider, 3: SUV, 4: Offroad, 5: Tuner, 6: Bike Wheels, 7: High End
  30. if(inTable(sport, VEHICLE.GET_VEHICLE_CLASS(int))) then
  31. --Set the wheel type according to the above
  32. VEHICLE.SET_VEHICLE_WHEEL_TYPE(int, 7)
  33. --Change the style of rim by changing the 3rd parameter
  34. VEHICLE.SET_VEHICLE_MOD(int, 23, 7, true)
  35. end
  36. if(inTable(offroad, VEHICLE.GET_VEHICLE_CLASS(int))) then
  37. VEHICLE.SET_VEHICLE_WHEEL_TYPE(int, 4)
  38. VEHICLE.SET_VEHICLE_MOD(int, 23, 6, true)
  39. end
  40. if(inTable(suv, VEHICLE.GET_VEHICLE_CLASS(int))) then
  41. VEHICLE.SET_VEHICLE_WHEEL_TYPE(int, 3)
  42. VEHICLE.SET_VEHICLE_MOD(int, 23, 13, true)
  43. end
  44.  
  45. return
  46. end
  47.  
  48. --Returns the maximum available mod slot
  49. local function getMods(veh, int)
  50. if(VEHICLE.GET_NUM_VEHICLE_MODS(veh, int) > 1) then
  51. return VEHICLE.GET_NUM_VEHICLE_MODS(veh, int)-1 end
  52. return 0
  53. end
  54.  
  55. --sometimes, you just want to upgrade the looks a little bit...
  56. local function getMinMods(veh, int)
  57. if(VEHICLE.GET_NUM_VEHICLE_MODS(veh, int) > 0) then
  58. return 1 end
  59. return 0
  60. end
  61.  
  62. function car.tick()
  63. local playerPed = PLAYER.PLAYER_PED_ID()
  64. local player = PLAYER.GET_PLAYER_PED(playerPed)
  65. local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)
  66. local myCar = PED.GET_VEHICLE_PED_IS_USING(player)
  67. if(playerExists) then
  68. if(PED.IS_PED_IN_ANY_VEHICLE(playerPed, false)) then
  69. local veh = PED.GET_VEHICLE_PED_IS_IN(playerPed,true)
  70. --------------------------------------------------
  71. -- Maximum Mods (M) --
  72. --------------------------------------------------
  73. if(get_key_pressed(77))then
  74. VEHICLE.SET_VEHICLE_MOD_KIT(veh, 0)
  75. VEHICLE.SET_VEHICLE_NUMBER_PLATE_TEXT(veh, 'BOSS-MAN')
  76. --Spoilers
  77. VEHICLE.SET_VEHICLE_MOD(veh, 0, getMods(veh, 0), true)
  78. --Front Bumper
  79. VEHICLE.SET_VEHICLE_MOD(veh, 1, getMods(veh, 1), true)
  80. --Rear Bumper
  81. VEHICLE.SET_VEHICLE_MOD(veh, 2, getMods(veh, 2), true)
  82. --Side Skirt
  83. VEHICLE.SET_VEHICLE_MOD(veh, 3, getMods(veh, 3), true)
  84. --Exhaust
  85. VEHICLE.SET_VEHICLE_MOD(veh, 4, getMods(veh, 4), true)
  86. --Frame
  87. VEHICLE.SET_VEHICLE_MOD(veh, 5, getMods(veh, 5), true)
  88. --Grille
  89. VEHICLE.SET_VEHICLE_MOD(veh, 6, getMods(veh, 6), true)
  90. --Hood
  91. VEHICLE.SET_VEHICLE_MOD(veh, 7, getMods(veh, 7), true)
  92. --Fender
  93. VEHICLE.SET_VEHICLE_MOD(veh, 8, getMods(veh, 8), true)
  94. --Right Fender
  95. VEHICLE.SET_VEHICLE_MOD(veh, 9, getMods(veh, 9), true)
  96. --Roof
  97. VEHICLE.SET_VEHICLE_MOD(veh, 10, getMods(veh, 10), true)
  98. -----------------------------------------------
  99. -- These Mods are constant for every vehicle --
  100. -----------------------------------------------
  101. --Tint (-1 = Stock, 0 = None, 1 = Limo, 2 = Dark Smoke, 3 = Light Smoke, 4 = None, 5 = Blacked Out, 6 =
  102.  
  103. Green)
  104. VEHICLE.SET_VEHICLE_WINDOW_TINT(veh, 1)
  105. --Turbo
  106. VEHICLE.TOGGLE_VEHICLE_MOD(veh, 18, true)
  107. --Headlights(22=Xenon)
  108. VEHICLE.TOGGLE_VEHICLE_MOD(veh, 22, true)
  109. --Engine (0: Level 1, 1: Level 2, 2: Level 3, 3: Level 4)
  110. VEHICLE.SET_VEHICLE_MOD(veh, 11, getMods(veh, 11), true)
  111. --Brakes (0: Street, 1: Sport, 2: Race )
  112. VEHICLE.SET_VEHICLE_MOD(veh, 12, getMods(veh, 12), true)
  113. --Transmission (1: Street, 2: Sport, 3: Race)
  114. VEHICLE.SET_VEHICLE_MOD(veh, 13, getMods(veh, 13), true)
  115. --Horns
  116. --[[0: Truck, 1: Cop, 2: Clown
  117. --3: Musical 1, 4: Musical 2, 5: Musical 3, 6: Musical 4, 7: Musical 5
  118. --8: Classical 1, 9: Classical 2, 10: Classical 3, 11: Classical 4, 12: Classical 5, 13:
  119.  
  120. Classical 6, 14:
  121.  
  122. Classical 7
  123. --15: Do, 16: Re, 17: Mi, 18: Fa, 19: Sol, 20: La, 21: Ti, 22: Do (High)
  124. --23: Jazz 1, 24: Jazz 2, 25: Jazz 3, 26: Jazz Loop
  125. --27: Star Spangled Banner 1, 28: Star Spangled Banner 2, 29: Star Spangled Banner 3,
  126.  
  127. 30: Star Spangled
  128.  
  129. Banner 4
  130. ]]--
  131. VEHICLE.SET_VEHICLE_MOD(veh, 14, 1, true)
  132. --Suspension (0: Lowered, 1: Street, 2: Sport, 3: Competition)
  133. VEHICLE.SET_VEHICLE_MOD(veh, 15, getMods(veh, 15), true)
  134. --Armor (0: 20%, 1: 40%, 2: 60%, 3: 80%, 4: 100%)
  135. VEHICLE.SET_VEHICLE_MOD(veh, 16, getMods(veh, 16), true)
  136.  
  137. --Clean and repair
  138. repairVeh(veh)
  139. --Set rim style
  140. setWheels(veh)
  141. --Wheel Color, Black
  142. VEHICLE.SET_VEHICLE_EXTRA_COLOURS(veh,111,1)
  143.  
  144. local testmodule = {}
  145. end
  146. --------------------------------------------------
  147. -- Bare Minimum Mods (,) --
  148. --------------------------------------------------
  149. if(get_key_pressed(188))then
  150. VEHICLE.SET_VEHICLE_MOD_KIT(veh, 0)
  151. VEHICLE.SET_VEHICLE_NUMBER_PLATE_TEXT(veh, 'DR PEPPER')
  152. --Spoilers
  153. VEHICLE.SET_VEHICLE_MOD(veh, 0, getMinMods(veh, 0), true)
  154. --Front Bumper
  155. VEHICLE.SET_VEHICLE_MOD(veh, 1, getMinMods(veh, 1), true)
  156. --Rear Bumper
  157. VEHICLE.SET_VEHICLE_MOD(veh, 2, getMinMods(veh, 2), true)
  158. --Side Skirt
  159. VEHICLE.SET_VEHICLE_MOD(veh, 3, getMinMods(veh, 3), true)
  160. --Exhaust
  161. VEHICLE.SET_VEHICLE_MOD(veh, 4, getMinMods(veh, 4), true)
  162. --Frame
  163. VEHICLE.SET_VEHICLE_MOD(veh, 5, getMinMods(veh, 5), true)
  164. --Grille
  165. VEHICLE.SET_VEHICLE_MOD(veh, 6, getMinMods(veh, 6), true)
  166. --Hood
  167. VEHICLE.SET_VEHICLE_MOD(veh, 7, getMinMods(veh, 7), true)
  168. --Fender
  169. VEHICLE.SET_VEHICLE_MOD(veh, 8, getMinMods(veh, 8), true)
  170. --Right Fender
  171. VEHICLE.SET_VEHICLE_MOD(veh, 9, getMinMods(veh, 9), true)
  172. --Roof
  173. VEHICLE.SET_VEHICLE_MOD(veh, 10, getMinMods(veh, 10), true)
  174. local testmodule = {}
  175. end
  176. --Silver Rims (N)
  177. if(get_key_pressed(78))then
  178. VEHICLE.SET_VEHICLE_MOD_KIT(veh, 0)
  179. --Set rim style
  180. setWheels(veh)
  181. --Rim Color (vehicle, type, color index
  182. VEHICLE.SET_VEHICLE_EXTRA_COLOURS(veh,111,4)
  183. --Repair/Clean Vehicle
  184. repairVeh(veh)
  185.  
  186. local testmodule = {}
  187. end
  188.  
  189. --Black Color Coordination (Numpad 1)
  190. if(get_key_pressed(97))then
  191. VEHICLE.SET_VEHICLE_MOD_KIT(veh, 0)
  192. VEHICLE.CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR(veh)
  193. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  194. VEHICLE.SET_VEHICLE_COLOURS(veh, 1, 1)
  195.  
  196. --Rim Color (vehicle, type, color index
  197. VEHICLE.SET_VEHICLE_EXTRA_COLOURS(veh,120,1)
  198.  
  199. --Tire Smoke
  200. VEHICLE.TOGGLE_VEHICLE_MOD(veh, 20, true)
  201. VEHICLE.SET_VEHICLE_TYRE_SMOKE_COLOR(veh, 8,8,8)
  202.  
  203. --Repair/Clean Vehicle
  204. repairVeh(veh)
  205.  
  206. local testmodule = {}
  207. end
  208.  
  209. --Blue Color Coordination (Numpad 2)
  210. if(get_key_pressed(98))then
  211. VEHICLE.SET_VEHICLE_MOD_KIT(veh, 0)
  212. VEHICLE.CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR(veh)
  213. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  214. VEHICLE.SET_VEHICLE_COLOURS(veh, 73, 73)
  215.  
  216. --Rim Color (vehicle, type, color index
  217. VEHICLE.SET_VEHICLE_EXTRA_COLOURS(veh,70,73)
  218.  
  219. --Tire Smoke
  220. VEHICLE.TOGGLE_VEHICLE_MOD(veh, 20, true)
  221. VEHICLE.SET_VEHICLE_TYRE_SMOKE_COLOR(veh, 0,85,196)
  222.  
  223. --Repair/Clean Vehicle
  224. repairVeh(veh)
  225. local testmodule = {}
  226. end
  227.  
  228. --Red Color Coordination (Numpad 3)
  229. if(get_key_pressed(99))then
  230. VEHICLE.SET_VEHICLE_MOD_KIT(veh, 0)
  231. VEHICLE.CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR(veh)
  232. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  233. VEHICLE.SET_VEHICLE_COLOURS(veh, 29, 29)
  234.  
  235. --Rim Color (vehicle, type, color index
  236. VEHICLE.SET_VEHICLE_EXTRA_COLOURS(veh,28,29)
  237.  
  238. --Tire Smoke
  239. VEHICLE.TOGGLE_VEHICLE_MOD(veh, 20, true)
  240. VEHICLE.SET_VEHICLE_TYRE_SMOKE_COLOR(veh, 138,11,0)
  241.  
  242. --Repair/Clean Vehicle
  243. repairVeh(veh)
  244.  
  245. local testmodule = {}
  246. end
  247.  
  248. --Yellow Color Coordination (Numpad 4)
  249. if(get_key_pressed(100))then
  250. VEHICLE.SET_VEHICLE_MOD_KIT(veh, 0)
  251. VEHICLE.CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR(veh)
  252. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  253. VEHICLE.SET_VEHICLE_MOD_COLOR_1(veh, 1,33,33)
  254. VEHICLE.SET_VEHICLE_MOD_COLOR_2(veh, 1,33)
  255.  
  256. --Rim Color (vehicle, type, color index
  257. VEHICLE.SET_VEHICLE_EXTRA_COLOURS(veh,5,89)
  258.  
  259. --Tire Smoke
  260. VEHICLE.TOGGLE_VEHICLE_MOD(veh, 20, true)
  261. VEHICLE.SET_VEHICLE_TYRE_SMOKE_COLOR(veh, 217,166,0)
  262.  
  263. --Repair/Clean Vehicle
  264. repairVeh(veh)
  265.  
  266. local testmodule = {}
  267. end
  268.  
  269. --Green Color Coordination (Numpad 5)
  270. if(get_key_pressed(101))then
  271. VEHICLE.SET_VEHICLE_MOD_KIT(veh, 0)
  272. VEHICLE.CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR(veh)
  273. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  274. VEHICLE.SET_VEHICLE_COLOURS(veh, 0, 0)
  275.  
  276. --Rim Color (vehicle, type, color index
  277. VEHICLE.SET_VEHICLE_EXTRA_COLOURS(veh,55,0)
  278.  
  279. --Tire Smoke
  280. VEHICLE.TOGGLE_VEHICLE_MOD(veh, 20, true)
  281. VEHICLE.SET_VEHICLE_TYRE_SMOKE_COLOR(veh, 0,56,5)
  282.  
  283. --Repair/Clean Vehicle
  284. repairVeh(veh)
  285.  
  286. local testmodule = {}
  287. end
  288.  
  289. --White Color Coordination (Numpad 6)
  290. if(get_key_pressed(102))then
  291. VEHICLE.SET_VEHICLE_MOD_KIT(veh, 0)
  292. VEHICLE.CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR(veh)
  293. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  294. VEHICLE.SET_VEHICLE_COLOURS(veh, 111, 111)
  295.  
  296. --Rim Color (vehicle, type, color index
  297. VEHICLE.SET_VEHICLE_EXTRA_COLOURS(veh,112,111)
  298.  
  299. --Tire Smoke
  300. VEHICLE.TOGGLE_VEHICLE_MOD(veh, 20, true)
  301. VEHICLE.SET_VEHICLE_TYRE_SMOKE_COLOR(veh, 240,240,240)
  302.  
  303. --Repair/Clean Vehicle
  304. repairVeh(veh)
  305.  
  306. local testmodule = {}
  307. end
  308.  
  309. --Sliver Color Coordination (Numpad 7)
  310. if(get_key_pressed(103))then
  311. VEHICLE.SET_VEHICLE_MOD_KIT(veh, 0)
  312. VEHICLE.CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR(veh)
  313. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  314. VEHICLE.SET_VEHICLE_COLOURS(veh, 4, 4)
  315.  
  316. --Rim Color (vehicle, type, color index
  317. VEHICLE.SET_VEHICLE_EXTRA_COLOURS(veh,111,4)
  318.  
  319. --Tire Smoke
  320. VEHICLE.TOGGLE_VEHICLE_MOD(veh, 20, true)
  321. VEHICLE.SET_VEHICLE_TYRE_SMOKE_COLOR(veh, 8,8,8)
  322.  
  323. --Repair/Clean Vehicle
  324. repairVeh(veh)
  325.  
  326. local testmodule = {}
  327. end
  328.  
  329. --Gold Color Coordination (Numpad 8)
  330. if(get_key_pressed(104))then
  331. VEHICLE.SET_VEHICLE_MOD_KIT(veh, 0)
  332. VEHICLE.CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR(veh)
  333. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  334. VEHICLE.SET_VEHICLE_MOD_COLOR_1(veh, 4,3,3)
  335. VEHICLE.SET_VEHICLE_MOD_COLOR_2(veh, 4,3)
  336.  
  337. --Rim Color (vehicle, type, color index
  338. VEHICLE.SET_VEHICLE_EXTRA_COLOURS(veh,89,158)
  339.  
  340. --Tire Smoke
  341. VEHICLE.TOGGLE_VEHICLE_MOD(veh, 20, true)
  342. VEHICLE.SET_VEHICLE_TYRE_SMOKE_COLOR(veh, 8,8,8)
  343.  
  344. --Repair/Clean Vehicle
  345. repairVeh(veh)
  346.  
  347. local testmodule = {}
  348. end
  349.  
  350. --Chrome Color Coordination (Numpad 9)
  351. if(get_key_pressed(105))then
  352. VEHICLE.SET_VEHICLE_MOD_KIT(veh, 0)
  353. VEHICLE.CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR(veh)
  354. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  355. VEHICLE.SET_VEHICLE_MOD_COLOR_1(veh, 5,0,0)
  356. VEHICLE.SET_VEHICLE_MOD_COLOR_2(veh, 5,0)
  357.  
  358. --Rim Color (vehicle, type, color index
  359. VEHICLE.SET_VEHICLE_EXTRA_COLOURS(veh,5,4)
  360.  
  361. --Tire Smoke
  362. VEHICLE.TOGGLE_VEHICLE_MOD(veh, 20, true)
  363. VEHICLE.SET_VEHICLE_TYRE_SMOKE_COLOR(veh, 255,255,255)
  364.  
  365. --Repair/Clean Vehicle
  366. repairVeh(veh)
  367.  
  368. local testmodule = {}
  369. end
  370. ------------------------------------------------------------------
  371. -- Secondary Colors, Stripes, Details, etc --
  372. ------------------------------------------------------------------
  373. --black (B)
  374. if(get_key_pressed(66))then
  375. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  376. VEHICLE.SET_VEHICLE_MOD_COLOR_2(veh, 1,0)
  377. local testmodule = {}
  378. end
  379. --white (J)
  380. if(get_key_pressed(74))then
  381. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  382. VEHICLE.SET_VEHICLE_MOD_COLOR_2(veh, 1,73)
  383. local testmodule = {}
  384. end
  385. --chrome (K)
  386. if(get_key_pressed(75))then
  387. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  388. VEHICLE.SET_VEHICLE_MOD_COLOR_2(veh, 5,0)
  389. local testmodule = {}
  390. end
  391. --yellow (L)
  392. if(get_key_pressed(76))then
  393. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  394. VEHICLE.SET_VEHICLE_MOD_COLOR_2(veh, 1,33)
  395. local testmodule = {}
  396. end
  397. --red (I)
  398. if(get_key_pressed(73))then
  399. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  400. VEHICLE.SET_VEHICLE_MOD_COLOR_2(veh, 1,14)
  401. local testmodule = {}
  402. end
  403. --light blue (O)
  404. if(get_key_pressed(79))then
  405. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  406. VEHICLE.SET_VEHICLE_MOD_COLOR_2(veh, 1,53)
  407. local testmodule = {}
  408. end
  409. --dark blue (P)
  410. if(get_key_pressed(80))then
  411. VEHICLE.CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(veh)
  412. VEHICLE.SET_VEHICLE_MOD_COLOR_2(veh, 1,52)
  413. local testmodule = {}
  414. end
  415. end
  416. end
  417. end
  418. return car
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement