So Im trying to spawn a certain vehicle with a trailer attached to it for a job farm. This is my current script that only spawns the vehicle with no trailer.
function spawntractor()
Citizen.Wait(0)
local player = PlayerId()
local vehicle = GetHashKey('tracto5')
local trailer = GetHashKey('GrainTrailer')
RequestModel(vehicle)
while not HasModelLoaded(vehicle) do
Wait(1)
end
local plate = math.random(100, 900)
local tractor = CreateVehicle(vehicle,2551.86,4680.95,33.89 , 18, true, false)
SetVehicleOnGroundProperly(tractor)
AttachVehicleToTrailer(vehicle, trailer, 1.1)
local plate = "ZURRUPIO"..math.random(100, 900)
SetVehicleNumberPlateText(tractor, plate)
SetPedIntoVehicle(GetPlayerPed(-1), tractor, - 1)
SetModelAsNoLongerNeeded(vehicle)
Citizen.InvokeNative(0xB736A491E64A32CF, Citizen.PointerValueIntInitialized(tractor))
end
If anyone knows how can I spawn it with and attached trailer please let me know. Thanks.
