mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-09-04 17:23:31 +00:00
refactor(client/functions): Remove local rounding function for QBCore.Shared.Round
This commit is contained in:
+5
-14
@@ -265,15 +265,6 @@ end
|
|||||||
|
|
||||||
-- Vehicle
|
-- Vehicle
|
||||||
|
|
||||||
local function Round(value, numDecimalPlaces)
|
|
||||||
if numDecimalPlaces then
|
|
||||||
local power = 10 ^ numDecimalPlaces
|
|
||||||
return math.floor((value * power) + 0.5) / (power)
|
|
||||||
else
|
|
||||||
return math.floor(value + 0.5)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function Trim(value)
|
local function Trim(value)
|
||||||
if value then
|
if value then
|
||||||
return (string.gsub(value, '^%s*(.-)%s*$', '%1'))
|
return (string.gsub(value, '^%s*(.-)%s*$', '%1'))
|
||||||
@@ -343,11 +334,11 @@ function QBCore.Functions.GetVehicleProperties(vehicle)
|
|||||||
model = GetEntityModel(vehicle),
|
model = GetEntityModel(vehicle),
|
||||||
plate = Trim(GetVehicleNumberPlateText(vehicle)),
|
plate = Trim(GetVehicleNumberPlateText(vehicle)),
|
||||||
plateIndex = GetVehicleNumberPlateTextIndex(vehicle),
|
plateIndex = GetVehicleNumberPlateTextIndex(vehicle),
|
||||||
bodyHealth = Round(GetVehicleBodyHealth(vehicle), 1),
|
bodyHealth = QBCore.Shared.Round(GetVehicleBodyHealth(vehicle), 0.1),
|
||||||
engineHealth = Round(GetVehicleEngineHealth(vehicle), 1),
|
engineHealth = QBCore.Shared.Round(GetVehicleEngineHealth(vehicle), 0.1),
|
||||||
tankHealth = Round(GetVehiclePetrolTankHealth(vehicle), 1),
|
tankHealth = QBCore.Shared.Round(GetVehiclePetrolTankHealth(vehicle), 0.1),
|
||||||
fuelLevel = Round(GetVehicleFuelLevel(vehicle), 1),
|
fuelLevel = QBCore.Shared.Round(GetVehicleFuelLevel(vehicle), 0.1),
|
||||||
dirtLevel = Round(GetVehicleDirtLevel(vehicle), 1),
|
dirtLevel = QBCore.Shared.Round(GetVehicleDirtLevel(vehicle), 0.1),
|
||||||
color1 = colorPrimary,
|
color1 = colorPrimary,
|
||||||
color2 = colorSecondary,
|
color2 = colorSecondary,
|
||||||
pearlescentColor = pearlescentColor,
|
pearlescentColor = pearlescentColor,
|
||||||
|
|||||||
Reference in New Issue
Block a user