Skip to content

Commit

Permalink
fix: implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
mafewtm authored and ChatDisabled committed Dec 24, 2023
1 parent 70e1123 commit 1228b0a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ RegisterNetEvent('qb-garages:client:takeOutGarage', function(data)
return
end

local netId = lib.callback.await('qb-garage:server:spawnvehicle', false, vehicle, type == 'house' and garage.coords or garage.spawn, config.warpInVehicle)
local netId = lib.callback.await('qb-garage:server:spawnvehicle', false, vehicle, type == 'house' and garage.coords or garage.spawn, sharedConfig.takeOut.warpInVehicle)
local timeout = 100
while not NetworkDoesEntityExistWithNetworkId(netId) and timeout > 0 do
Wait(10)
Expand All @@ -206,6 +206,7 @@ RegisterNetEvent('qb-garages:client:takeOutGarage', function(data)
doCarDamage(veh, vehicle)
TriggerServerEvent('qb-garage:server:updateVehicleState', 0, vehicle.plate, index)
TriggerEvent('vehiclekeys:client:SetOwner', vehicle.plate)
if not sharedConfig.takeOut.engineOff then SetVehicleEngineOn(veh, true, true, false) end
Wait(500)
end)

Expand Down
1 change: 0 additions & 1 deletion config/client.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
return {
useTarget = false,
debugPoly = false,
warpInVehicle = false, -- If true, player will warp into vehicle upon taking the vehicle out.
visuallyDamageCars = true, -- True == Visually damage cars that go out of the garage depending of body damage, false == Do not visually damage cars (damage is still applied to car values)
}
8 changes: 7 additions & 1 deletion config/shared.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
return {
takeOut = {
warpInVehicle = false, -- If false, player will no longer warp into vehicle upon taking the vehicle out.
doorsLocked = true, -- If true, the doors will be locked upon taking the vehicle out.
engineOff = true, -- If true, the engine will be off upon taking the vehicle out.
},

houseGarages = {}, -- Dont touch
garages = {

Expand All @@ -13,7 +19,7 @@ return {
---@field blipColor number? -- Color for the blip
---@field type public | job | gang | depot -- Type of garage
---@field vehicle car | air | sea | all -- Vehicle type
---@field job string? -- Job / Gang name
---@field job string? -- Job / Gang name

---@type table<garageName, GarageConfig>

Expand Down
2 changes: 1 addition & 1 deletion server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ lib.callback.register('qb-garage:server:spawnvehicle', function (source, vehInfo
local netId = SpawnVehicle(source, vehInfo.vehicle, coords, warp, vehProps)
local veh = NetworkGetEntityFromNetworkId(netId)
SetVehicleNumberPlateText(veh, plate)
SetVehicleDoorsLocked(veh, 2)
if sharedConfig.takeOut.doorsLocked then SetVehicleDoorsLocked(veh, 2) end
outsideVehicles[plate] = {netID = netId, entity = veh}
return netId
end)
Expand Down

0 comments on commit 1228b0a

Please sign in to comment.