Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use vehicle entity from spawn function #70

Merged
merged 1 commit into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)