Skip to content

Commit

Permalink
fix(bridge/qb): QBCore:Client:VehicleInfo passes netId back to the cl…
Browse files Browse the repository at this point in the history
…ient

* passing vehicle to client via network id

* passing netId through to client

* remove empty function
  • Loading branch information
Manason authored Nov 10, 2023
1 parent d60f0be commit eb9e381
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
9 changes: 5 additions & 4 deletions bridge/qb/client/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ RegisterNetEvent('QBCore:Command:CallCommand', function(command)
end)

RegisterNetEvent('QBCore:Client:VehicleInfo', function(info)
local plate = GetPlate(info.vehicle)
local vehicle = NetworkGetEntityFromNetworkId(info.netId)
local plate = GetPlate(vehicle)
local hasKeys = true

if GetResourceState('qb-vehiclekeys') == 'started' then
hasKeys = exports['qb-vehiclekeys']:HasKeys()
end

local data = {
vehicle = info.vehicle,
vehicle = vehicle,
seat = info.seat,
name = info.modelName,
plate = plate,
driver = GetPedInVehicleSeat(info.vehicle, -1),
inseat = GetPedInVehicleSeat(info.vehicle, info.seat),
driver = GetPedInVehicleSeat(vehicle, -1),
inseat = GetPedInVehicleSeat(vehicle, info.seat),
haskeys = hasKeys
}

Expand Down
9 changes: 6 additions & 3 deletions bridge/qb/server/events.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
-- Vehicles
RegisterServerEvent('baseevents:enteringVehicle', function(veh,seat,modelName)
RegisterServerEvent('baseevents:enteringVehicle', function(veh, seat, modelName, netId)
local src = source
local data = {
vehicle = veh,
seat = seat,
name = modelName,
netId = netId,
event = 'Entering'
}
TriggerClientEvent('QBCore:Client:VehicleInfo', src, data)
end)

RegisterServerEvent('baseevents:enteredVehicle', function(veh,seat,modelName)
RegisterServerEvent('baseevents:enteredVehicle', function(veh, seat, modelName, netId)
local src = source
local data = {
vehicle = veh,
seat = seat,
name = modelName,
netId = netId,
event = 'Entered'
}
TriggerClientEvent('QBCore:Client:VehicleInfo', src, data)
Expand All @@ -26,12 +28,13 @@ RegisterServerEvent('baseevents:enteringAborted', function()
TriggerClientEvent('QBCore:Client:AbortVehicleEntering', src)
end)

RegisterServerEvent('baseevents:leftVehicle', function(veh,seat,modelName)
RegisterServerEvent('baseevents:leftVehicle', function(veh, seat, modelName, netId)
local src = source
local data = {
vehicle = veh,
seat = seat,
name = modelName,
netId = netId,
event = 'Left'
}
TriggerClientEvent('QBCore:Client:VehicleInfo', src, data)
Expand Down

0 comments on commit eb9e381

Please sign in to comment.