diff --git a/[esx_addons]/esx_lscustom/client/main.lua b/[esx_addons]/esx_lscustom/client/main.lua index b5273d1b..f203e2e9 100644 --- a/[esx_addons]/esx_lscustom/client/main.lua +++ b/[esx_addons]/esx_lscustom/client/main.lua @@ -14,7 +14,7 @@ RegisterNetEvent('esx_lscustom:installMod') AddEventHandler('esx_lscustom:installMod', function() local vehicle = GetVehiclePedIsIn(PlayerPedId(), false) myCar = ESX.Game.GetVehicleProperties(vehicle) - TriggerServerEvent('esx_lscustom:refreshOwnedVehicle', myCar) + TriggerServerEvent('esx_lscustom:refreshOwnedVehicle', myCar, NetworkGetNetworkIdFromEntity(vehicle)) end) RegisterNetEvent('esx_lscustom:restoreMods', function(netId, props) @@ -79,8 +79,8 @@ function OpenLSMenu(elems, menuName, menuTitle, parent) if data.current.label == TranslateCap('by_default') or string.match(data.current.label, TranslateCap('installed')) then ESX.ShowNotification(TranslateCap('already_own', data.current.label)) - myCar = ESX.Game.GetVehicleProperties(vehicle) - TriggerServerEvent('esx_lscustom:refreshOwnedVehicle', myCar) + myCar = ESX.Game.GetVehicleProperties(vehicle) + TriggerServerEvent('esx_lscustom:refreshOwnedVehicle', myCar, NetworkGetNetworkIdFromEntity(vehicle)) else local vehiclePrice = 50000 diff --git a/[esx_addons]/esx_lscustom/config.lua b/[esx_addons]/esx_lscustom/config.lua index ecd59c84..b8477198 100644 --- a/[esx_addons]/esx_lscustom/config.lua +++ b/[esx_addons]/esx_lscustom/config.lua @@ -495,7 +495,7 @@ Config.Menus = { label = TranslateCap('transmission'), parent = 'upgrades', modType = 13, - price = {13.95, 20.93, 46.51} + price = {13.95, 20.93, 46.51, 63.55} }, modSuspension = { label = TranslateCap('suspension'), diff --git a/[esx_addons]/esx_lscustom/server/main.lua b/[esx_addons]/esx_lscustom/server/main.lua index 5879b7dc..e090f040 100644 --- a/[esx_addons]/esx_lscustom/server/main.lua +++ b/[esx_addons]/esx_lscustom/server/main.lua @@ -4,10 +4,10 @@ local Customs = {} RegisterNetEvent('esx_lscustom:startModing', function(props, netId) local src = tostring(source) if Customs[src] then - Customs[src][props.plate] = {props = props, netId = netId} + Customs[src][tostring(props.plate)] = {props = props, netId = netId} else Customs[src] = {} - Customs[src][props.plate] = {props = props, netId = netId} + Customs[src][tostring(props.plate)] = {props = props, netId = netId} end end) @@ -70,16 +70,25 @@ AddEventHandler('esx_lscustom:buyMod', function(price) end) RegisterServerEvent('esx_lscustom:refreshOwnedVehicle') -AddEventHandler('esx_lscustom:refreshOwnedVehicle', function(vehicleProps) +AddEventHandler('esx_lscustom:refreshOwnedVehicle', function(vehicleProps, netId) + local src = tostring(source) local xPlayer = ESX.GetPlayerFromId(source) - MySQL.single('SELECT vehicle FROM owned_vehicles WHERE plate = ?', {vehicleProps.plate}, function(result) if result then local vehicle = json.decode(result.vehicle) if vehicleProps.model == vehicle.model then MySQL.update('UPDATE owned_vehicles SET vehicle = ? WHERE plate = ?', {json.encode(vehicleProps), vehicleProps.plate}) - Customs[tostring(source)][tostring(vehicleProps.plate)].props = vehicleProps + if Customs[src] then + if Customs[src][tostring(vehicleProps.plate)] then + Customs[src][tostring(vehicleProps.plate)].props = vehicleProps + else + Customs[src][tostring(vehicleProps.plate)] = {props = vehicleProps, netId = netId} + end + else + Customs[src] = {} + Customs[src][tostring(vehicleProps.plate)] = {props = vehicleProps, netId = netId} + end else print(('[^3WARNING^7] Player ^5%s^7 Attempted To upgrade with mismatching vehicle model'):format(xPlayer.source)) end