Skip to content

Commit

Permalink
feat: remove storage function in favor of qbx_vehicles export
Browse files Browse the repository at this point in the history
  • Loading branch information
TonybynMp4 authored Mar 8, 2024
1 parent 71ada2b commit a2c58ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
11 changes: 3 additions & 8 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down Expand Up @@ -289,7 +287,6 @@ RegisterNetEvent('qbx_vehicleshop:server:financeVehicle', function(downPayment,

InsertVehicleEntityWithFinance({
insertVehicleEntityRequest = {
license = player.PlayerData.license,
citizenId = cid,
model = vehicle,
plate = plate,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -397,7 +393,6 @@ RegisterNetEvent('qbx_vehicleshop:server:sellfinanceVehicle', function(downPayme

InsertVehicleEntityWithFinance({
insertVehicleEntityRequest = {
license = target.PlayerData.license,
citizenId = cid,
model = vehicle,
plate = plate,
Expand Down
15 changes: 1 addition & 14 deletions server/storage.lua
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit a2c58ac

Please sign in to comment.