jg-advancedgarages

  1. Navigate to the jg-advancedgarages/framework/cl-functions.lua

  2. Find Framework.Client.SetVehicleProperties and customize:

---@param vehicle integer
---@param props table
function Framework.Client.SetVehicleProperties(vehicle, props)
  if GetResourceState("jg-mechanic") == "started" then
    return exports["jg-mechanic"]:setVehicleProperties(vehicle, props)
  else
    if Config.Framework == "QBCore" then
      TriggerServerEvent('JGxVMS:ApplyTuning', NetworkGetNetworkIdFromEntity(vehicle), props) -- Added
      return QBCore.Functions.SetVehicleProperties(vehicle, props)
    elseif Config.Framework == "Qbox" then
      TriggerServerEvent('JGxVMS:ApplyTuning', NetworkGetNetworkIdFromEntity(vehicle), props) -- Added
      return lib.setVehicleProperties(vehicle, props)
    elseif Config.Framework == "ESX" then
      TriggerServerEvent('JGxVMS:ApplyTuning', NetworkGetNetworkIdFromEntity(vehicle), props) -- Added
      return ESX.Game.SetVehicleProperties(vehicle, props)
    end
  end
end

  1. Navigate to the jg-advancedgarages/config/config-sv.lua

  2. Register new server event:

RegisterNetEvent('JGxVMS:ApplyTuning', function(netId, props)
    local entity = NetworkGetEntityFromNetworkId(netId)
    TriggerEvent("entityCreated", entity)
    Entity(entity).state:set('VehicleProperties', props, true)
end)

Last updated

Was this helpful?