Native referenceRedMclient

GET_ALL_VEHICLE_MODELS

0xD7531645 CFX
FUNCTION SIGNATURE
object GET_ALL_VEHICLE_MODELS(/* parameters not documented */);
Property Value
Native Name GET_ALL_VEHICLE_MODELS
Hash 0xD7531645
Return Type object
API Set client

Description: Returns all registered vehicle model names, including non-dlc vehicles and custom vehicles in no particular order.

Example output

	["dubsta", "dubsta2", "dubsta3", "myverycoolcar", "sultan", "sultanrs", ...]

This native will not return vehicles that are unregistered (i.e from a resource being stopped) during runtime.

Examples

RegisterCommand("spawnrandomcar", function()
	local vehicles = GetAllVehicleModels()
	local veh = vehicles[math.random(1, #vehicles)]
	RequestModel(veh)
	repeat Wait(0) until HasModelLoaded(veh)
	local veh = CreateVehicle(veh, GetEntityCoords(PlayerPedId()), GetEntityHeading(PlayerPedId()), true, false)
	SetPedIntoVehicle(PlayerPedId(), veh, -1)
end)
Back to CFX