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

feat: add option to exclude vehicle categories from locking upon spawn #121

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions config/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ return {
autoRespawn = false, -- True == auto respawn cars that are outside into your garage on script restart, false == does not put them into your garage and players have to go to the impound
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.
noLockCategories = { 'motorcycles', 'cycles' }, -- A list of vehicle categories that won't lock upon taking the vehicle out.
distanceCheck = 5.0, -- The distance that needs to bee clear to let the vehicle spawn, this prevents vehicles stacking on top of each other
---calculates the automatic impound fee.
---@param vehicleId integer
Expand Down
3 changes: 2 additions & 1 deletion server/spawn-vehicle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ lib.callback.register('qbx_garages:server:spawnVehicle', function (source, vehic

local warpPed = Config.warpInVehicle and GetPlayerPed(source)
local netId, veh = qbx.spawnVehicle({ spawnSource = spawnCoords, model = playerVehicle.props.model, props = playerVehicle.props, warp = warpPed})
local vehicleCategory = exports.qbx_core:GetVehiclesByName()[playerVehicle.modelName].category

if Config.doorsLocked then
if Config.doorsLocked and not lib.table.contains(Config.noLockCategories, vehicleCategory) then
SetVehicleDoorsLocked(veh, 2)
end

Expand Down