diff --git a/client/functions.lua b/client/functions.lua index 71e0ef4..650981a 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -265,14 +265,6 @@ end -- Vehicle -local function Trim(value) - if value then - return (string.gsub(value, '^%s*(.-)%s*$', '%1')) - else - return nil - end -end - function QBCore.Functions.SpawnVehicle(model, cb, coords, isnetworked) local model = GetHashKey(model) local ped = PlayerPedId() @@ -308,7 +300,7 @@ end function QBCore.Functions.GetPlate(vehicle) if vehicle == 0 then return end - return Trim(GetVehicleNumberPlateText(vehicle)) + return QBCore.Shared.Trim(GetVehicleNumberPlateText(vehicle)) end function QBCore.Functions.GetVehicleProperties(vehicle) @@ -332,7 +324,7 @@ function QBCore.Functions.GetVehicleProperties(vehicle) return { model = GetEntityModel(vehicle), - plate = Trim(GetVehicleNumberPlateText(vehicle)), + plate = QBCore.Shared.Trim(GetVehicleNumberPlateText(vehicle)), plateIndex = GetVehicleNumberPlateTextIndex(vehicle), bodyHealth = QBCore.Shared.Round(GetVehicleBodyHealth(vehicle), 0.1), engineHealth = QBCore.Shared.Round(GetVehicleEngineHealth(vehicle), 0.1), diff --git a/shared.lua b/shared.lua index 59339d9..a9bd249 100644 --- a/shared.lua +++ b/shared.lua @@ -36,6 +36,14 @@ QBShared.SplitStr = function(str, delimiter) return result end +QBShared.Trim = function(value) + if value then + return (string.gsub(value, '^%s*(.-)%s*$', '%1')) + else + return nil + end +end + -- Math Rounding Credits: http://lua-users.org/wiki/SimpleRound QBShared.Sign = function(v) return (v >= 0 and 1) or -1 @@ -46,6 +54,7 @@ QBShared.Round = function(v, bracket) return QBShared.Sign(v/bracket + QBShared.Sign(v) * 0.5) * bracket end + QBShared.StarterItems = { ['phone'] = { amount = 1, item = 'phone' }, ['id_card'] = { amount = 1, item = 'id_card' },