diff --git a/server/main.lua b/server/main.lua index 5461605..79aec26 100644 --- a/server/main.lua +++ b/server/main.lua @@ -244,11 +244,9 @@ RegisterNetEvent('qbx_vehicleshop:server:buyShowroomVehicle', function(vehicle) return end - local cid = player.PlayerData.citizenid local plate = generatePlate() - InsertVehicleEntity({ - license = player.PlayerData.license, - citizenId = cid, + exports.qbx_vehicles:CreateVehicleEntity({ + citizenId = player.PlayerData.citizenid, model = vehicle, plate = plate, }) @@ -289,7 +287,6 @@ RegisterNetEvent('qbx_vehicleshop:server:financeVehicle', function(downPayment, InsertVehicleEntityWithFinance({ insertVehicleEntityRequest = { - license = player.PlayerData.license, citizenId = cid, model = vehicle, plate = plate, @@ -350,8 +347,7 @@ RegisterNetEvent('qbx_vehicleshop:server:sellShowroomVehicle', function(data, pl if not sellShowroomVehicleTransact(src, target, vehiclePrice, vehiclePrice) then return end - InsertVehicleEntity({ - license = target.PlayerData.license, + exports.qbx_vehicles:CreateVehicleEntity({ citizenId = cid, model = vehicle, plate = plate @@ -397,7 +393,6 @@ RegisterNetEvent('qbx_vehicleshop:server:sellfinanceVehicle', function(downPayme InsertVehicleEntityWithFinance({ insertVehicleEntityRequest = { - license = target.PlayerData.license, citizenId = cid, model = vehicle, plate = plate, diff --git a/server/storage.lua b/server/storage.lua index c94de85..7dceafc 100644 --- a/server/storage.lua +++ b/server/storage.lua @@ -1,20 +1,8 @@ ---@class InsertVehicleEntityRequest ----@field license string ---@field citizenId string ---@field model string ---@field plate string ----@param request InsertVehicleEntityRequest ----@return integer vehicleId -function InsertVehicleEntity(request) - return exports.qbx_vehicles:CreateVehicleEntity({ - citizenId = request.citizenId, - model = request.model, - plate = request.plate, - state = 0 - }) -end - ---@class VehicleFinanceServer ---@field balance number ---@field payment number @@ -27,8 +15,7 @@ end ---@param request InsertVehicleEntityWithFinanceRequest function InsertVehicleEntityWithFinance(request) - local vehicleId = InsertVehicleEntity({ - license = request.insertVehicleEntityRequest.license, + local vehicleId = exports.qbx_vehicles:CreateVehicleEntity({ citizenId = request.insertVehicleEntityRequest.citizenId, model = request.insertVehicleEntityRequest.model, plate = request.insertVehicleEntityRequest.plate