Hello, I have been working on some custom scripts recently and have failed to find a list of complete, updated wheels in GTA V.
So I took it up to myself to compile such a list and share it with y’all.
Idk which tag in the title to use for this one, don’t hate me for it please.
Keep in mind that you will have to actually write some code to utilise this, copy pasting stuff will not work. Especially with ESX menus.
DOWNLOAD
gtavwheels.json (70.9 KB)
VirustTotal of a JSON file, for those out there who won’t click download without a virus scan.
Usage
You can use this JSON file however you want to but the intended method of usage is:
-
Use this guide to load the JSON file server side
-
Send the data you have loaded using the guide to the client, you will probably have to use a custom script that would look like this on the client side to load the data, presumably in a event handler.
-- Make these global (at top of script)
local WheelsSport = {}
local WheelsMuscle = {}
-- Add the rest
-----------------------------------------------------
-- Put the code below in a event handler
for i = 1, #data, 1 do
if (data[i].CarType == 0) then
table.insert(WheelsSport, {Category = data[i].CarType, Label = data[i].Wheel, vID = data[i].vID})
elseif (data[i].CarType == 1) then
table.insert(WheelsMuscle, {Category = data[i].CarType, Label = data[i].Wheel, vID = data[i].vID})
end
-- This function is not finished, you need to complete it with the other Wheel types.
-- https://docs.fivem.net/natives/?_0xB3ED1BFB4BE636DC
end
There is a guide on the bottom of the post with parts of the code that will help you with implementing this in your scripts.
How do I use this with ESX?
ESX.Game.SetVehicleProperties(vehicle, {
wheels = 0,
modFrontWheels = -1
})
This sets vehicle wheel type to sport and wheel mod to default, replace values with what fits your code.
How do I use this without ESX?
SetVehicleWheelType(vehicle, 0)
SetVehicleMod(vehicle, 23, -1)
Sets vehicle to sport with default wheels mod, also replace values with what fits your code.
I don’t want to use this list but to make players only able to buy wheels for the vehicle they’re driving.
You usually want to get all available wheels in a single list, this one is compatible for use with ESX menus, just change value
to what you’re going to use.
local Wheels = {}
for i = -1, GetNumVehicleMods(vehicle, 23) -1, 1 do
table.insert(Wheels, {label = GetLabelText(GetModTextLabel(vehicle, 23, i)), value = 'changeme', vID = i}
end
How to use it with a ESX menu
local elements = Wheels
if (data.current.value == 'changeme') then
for i = 1, #Wheels, do
if (data.current.vID == Wheels[i].vID) then
ESX.Game.SetVehicleProperties(vehicle, {
wheels = Wheels[i].Category,
modFrontWheels = Wheels[i].vID
})
end
end
end
How to display all the wheel categories for any type of vehicle?
Create a new ESX menu with elements containing your wheel types.
elements = {
{label = 'Sport', value = 'wheels_sport', category = 0},
{label = 'Muscle', value = 'wheels_muscle', category = 1}
}
-- ^ finish the list with the types of wheels you want
Use some code from above to change the vehicle type to the one selected.
You need to add the selected list (that you added before, with a event handler) to a new elements list in a new sub-menu.
local elementsSport = {}
if (data.current.value == 'wheels_sport') then
for i = 1, #WheelsSport, 1 do
table.insert(elementsSport, {label = WheelsSport[i].Label, value = 'changeme', category = WheelsSport[i].Category, vID = WheelsSport[i].vID}
end
-- If a user has selected a menu option for sport wheels, we will load the wheels located in WheelsSport
Now we handle user selection inside the new menu that shows all wheels and labels.
if (data.current.value == 'changeme') then
ESX.Game.SetVehicleProperties(vehicle, {
wheels = data.current.category,
modFrontWheels = data.current.vID
})
end
That’s pretty much it.
If you created your menus and sub-menus correctly and loaded the JSON info into specific categories like shown how to at the beginning of the post you’ll be set to go and use this.
Once again, the menu examples shown here will not work if you copy + paste, you need to make your own menus and structure them accordingly
If you have noticed anything wrong with the code provided in this post or with the JSON file please notify me ASAP and I’ll try to make changes if needed.
There might be a wheel or two missing due to the way I checked for wheels but it seems like I got the most of them.
If anyone is interested, here is the code I used to obtain the list.
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
SetVehicleModKit(vehicle , 0)
-- Bikes are i = 6
-- So for the 1st set (0-5) I set the i loop to 5 times, then I used a different bit of code you can find at the bottom for bikes.
-- So after bikes were done, I set i back to 7 and completed the loop.
for i = 0, 11, 1 do
print('Setting vehicle wheel category to ' .. i)
ESX.Game.SetVehicleProperties(vehicle, {
wheels = i
})
print('Vehicle wheel category set to ' .. GetVehicleWheelType(vehicle))
for b = -1, GetNumVehicleMods(vehicle, 23) -1, 1 do
if (GetModTextLabel(vehicle, 23) == nil) then
print('Error! Did you set modkit?')
break
else
table.insert(VehicleWheels, {CarType = WheelType, Wheel = GetLabelText(GetModTextLabel(vehicle, 23, b)), ID = b})
print('Check ' .. b .. ' for ' .. GetVehicleWheelType(vehicle))
end
end
end
Code I used to get bike wheels
for i = -1, GetNumVehicleMods(vehicle, 23) -1, 1 do
if (GetModTextLabel(vehicle, 23) == nil) then
print('Error! Did you set modkit?')
else
table.insert(VehicleWheels, {CarType = GetVehicleWheelType(vehicle), Wheel = GetLabelText(GetModTextLabel(vehicle, 23, i)), ID = i})
print('Check ' .. i .. ' for ' .. GetVehicleWheelType(vehicle))
end
end
Edit: I noticed after posting that you can use the method I used to get the list to change the vehicles wheel type to what the player has selected and then do GetNumVehicleMods
for the new wheel category that has been set to the vehicle.
Thank you for reading!