I have this car mode: car mode it has 5 livery settings, but i don’t know how can i spawn 5 cars with 5 different livery.
I tried SetVehicleLivery(vehicle, 2) --I tried 1-5 the livery index but nothing changed.
Sorry for my bad english
I have this car mode: car mode it has 5 livery settings, but i don’t know how can i spawn 5 cars with 5 different livery.
I tried SetVehicleLivery(vehicle, 2) --I tried 1-5 the livery index but nothing changed.
Sorry for my bad english
What is vehicle
in this context?
RegisterCommand('car', function(source, args)
local vehicleName = args[1] or 'adder'
if not IsModelInCdimage(vehicleName) or not IsModelAVehicle(vehicleName) then
TriggerEvent('chat:addMessage', {
args = { 'It might have been a good thing that you tried to spawn a ' .. vehicleName .. '. Who even wants their spawning to actually ^*succeed?' }
})
return
end
RequestModel(vehicleName)
while not HasModelLoaded(vehicleName) do
Wait(500)
end
local playerPed = PlayerPedId()
local pos = GetEntityCoords(playerPed)
local vehicle = CreateVehicle(vehicleName, pos.x, pos.y, pos.z, GetEntityHeading(playerPed), true, false)
SetVehicleLivery(vehicle, 2)
SetPedIntoVehicle(playerPed, vehicle, -1)
SetEntityAsNoLongerNeeded(vehicle)
SetModelAsNoLongerNeeded(vehicleName)
TriggerEvent('chat:addMessage', {
args = { 'Woohoo! Enjoy your new ^*' .. vehicleName .. '!' }
})
end, false)
This is the carvariation.meta carvariation.meta
and the
I make a command instead, that look like this:
RegisterCommand('setLivery', function(source, args)
local Veh = GetVehiclePedIsIn(GetPlayerPed(-1))
local liveryIdx = tonumber(args[1])
SetVehicleLivery(Veh, liveryIdx)
TriggerEvent('chat:addMessage', {
args = {'Livery: '..args[1]}
})
end, false)
It works for sanchez, police cars and all of the base cars, that has a livery.
But it doesn’t change anything on this addon car.
I don’t know what should i change.