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

Me again. Looks like I wasn't the only person who was unaware of QBCore.Shared.Round. #157

Merged
merged 2 commits into from
Jan 20, 2025
Merged
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
10 changes: 2 additions & 8 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ local function getTextCoords(door)
return setTextCoords(door)
end

local function round(value, numDecimalPlaces)
if not numDecimalPlaces then return math.floor(value + 0.5) end
local power = 10 ^ numDecimalPlaces
return math.floor((value * power) + 0.5) / (power)
end

local function loadAnimDict(dict)
RequestAnimDict(dict)
while not HasAnimDictLoaded(dict) do
Expand Down Expand Up @@ -410,7 +404,7 @@ RegisterNetEvent('qb-doorlock:client:setState', function(serverId, doorID, state
return
end
else
if round(v.currentHeading, 0) == round(v.objYaw or v.objHeading, 0) then
if QBCore.Shared.Round(v.currentHeading, 0) == QBCore.Shared.Round(v.objYaw or v.objHeading, 0) then
DoorSystemSetDoorState(v.doorHash, 4, false, false)
end
end
Expand Down Expand Up @@ -442,7 +436,7 @@ RegisterNetEvent('qb-doorlock:client:setState', function(serverId, doorID, state
playSound(current, src, enableSounds)
return
else
if round(current.currentHeading, 0) == round(current.objYaw or current.objHeading, 0) then
if QBCore.Shared.Round(current.currentHeading, 0) == QBCore.Shared.Round(current.objYaw or current.objHeading, 0) then
DoorSystemSetDoorState(current.doorHash, 4, false, false)
end
end
Expand Down
Loading