From a65f2ed46c4006e47a0a6853dbd2bc19349199ec Mon Sep 17 00:00:00 2001 From: Holidayy95 <87913474+Holidayy95@users.noreply.github.com> Date: Mon, 20 Dec 2021 03:18:51 +0000 Subject: [PATCH] Adds function for vehicle extra PRs This adds the function for both qb-policejob and qb-ambulancejob VehicleExtra PRs https://github.com/qbcore-framework/qb-ambulancejob/pull/102 https://github.com/qbcore-framework/qb-ambulancejob/pull/103 https://github.com/qbcore-framework/qb-policejob/pull/199 https://github.com/qbcore-framework/qb-policejob/pull/200 --- shared.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/shared.lua b/shared.lua index 03307a7..19d6ad5 100644 --- a/shared.lua +++ b/shared.lua @@ -41,6 +41,18 @@ QBShared.Round = function(value, numDecimalPlaces) return math.floor((value * power) + 0.5) / (power) end +QBShared.SetDefaultVehicleExtras = function (vehicle, config) + -- Clear Extras + for i=1,20 do + if DoesExtraExist(vehicle, i) then + SetVehicleExtra(vehicle, i, 1) + end + end + + for id, enabled in pairs(config) do + QBShared.ChangeVehicleExtra(vehicle, tonumber(id), true) + end +end QBShared.StarterItems = { ['phone'] = { amount = 1, item = 'phone' },