Skip to content

Commit

Permalink
refactor: use vehicle entity from spawn function
Browse files Browse the repository at this point in the history
refactor: use vehicle entity from spawn function same as garage
  • Loading branch information
SKITTLE6969 authored May 8, 2024
1 parent f24d8f0 commit 997404a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ lib.callback.register('qbx_vehicleshop:server:GetVehiclesByName', function(sourc
end)

lib.callback.register('qbx_vehicleshop:server:spawnVehicle', function(source, model, coords, plate)
local netId = qbx.spawnVehicle({model = model, spawnSource = coords, warp = GetPlayerPed(source)})
local netId, veh = qbx.spawnVehicle({model = model, spawnSource = coords, warp = GetPlayerPed(source)})
if not netId or netId == 0 then return end
local veh = NetworkGetEntityFromNetworkId(netId)
if not veh or veh == 0 then return end

SetVehicleNumberPlateText(veh, plate)
Expand Down Expand Up @@ -506,4 +505,4 @@ lib.addCommand('transfervehicle', {help = locale('general.command_transfervehicl
exports.qbx_core:Notify(src, sellerMessage, 'success')
exports.qbx_core:Notify(buyerId, buyerMessage, 'success')
end, GetEntityModel(vehicle), sellAmount)
end)
end)

0 comments on commit 997404a

Please sign in to comment.