How do I get all available vehicle names and/or hashes in my server, INCLUDING the custom vehicles? C#

So I want to make a car spawner menu, like the ones on the Project Homecoming and 8th Gear racing servers. The main menu looks like this:


I’m using nativeUI ported to Fivem: GitHub - citizenfx/NativeUI: UI library for Grand Theft Auto V, ported to CitizenFX.
When you click on Spawn Car you get this menu:

These car classes house all the cars in the VehicleHash Enum at CitizenFX.Core.VehicleHash.
Example: Sedans

However, this enum does not contain all of the standard FiveM vehicles nor does it contain any of the custom vehicles in my resources folder. I want for this menu to display all spawnable cars in my server, not only the ones in the enum.
The search button gets user input with the native DisplayOnScreenKeyboard, and then spawns the vehicle given, if it exists. This works, even with custom vehicles.
I’ve already tried a couple of things to fix my issue:
Iterate through every possible uint to see if it is a vehicle hash and then save it. This might work in theory, but it takes way too long.

I also tried Vehicle.GetAllModels(), however that function seems to be broken and always returns 0.
I could create my own enum with all the hashes from the car resource files, but that is not dynamic, and it takes A LOT of time. Every time I add or remove a vehicle, I would have to update that enum, and it just seems to me that there should be a more elegant solution. Can anyone help me out?

I know it’s been a couple of years on this but did you ever figure out a solution to it?

RegisterCommand("allvehicles", function(source, args, raw)

	local vehicles = GetAllVehicleModels()
	for i = 1, #vehicles do
		print(i.. " " .. vehicles[i])
	end
end)

@_BigDaddy A little code snippet I made to test this native and can confirm it is working (might have been fixed in the meantime). Works also for addon vehicles.