Skip to content

Commit

Permalink
fix: some linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mafewtm committed Sep 23, 2023
1 parent e251df8 commit 00f8351
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
37 changes: 26 additions & 11 deletions client/binoculars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ local speed_lr = 8.0 -- speed by which the camera pans left-right
local speed_ud = 8.0 -- speed by which the camera pans up-down
local binoculars = false
local fov = (fov_max + fov_min) * 0.5
local storeBinoclarKey = 177 -- backspace
local cam = nil
local scaleform = nil
local storeBinoclarKey = 177 -- Backspace

--FUNCTIONS--

Expand All @@ -25,21 +23,37 @@ end

local function HandleZoom(cam)
if not IsPedSittingInAnyVehicle(cache.ped) then
if IsControlJustPressed(0, 241) then fov = math.max(fov - zoomspeed, fov_min) end -- scrollup
if IsControlJustPressed(0, 242) then fov = math.min(fov + zoomspeed, fov_max) end -- scrolldown
if IsControlJustPressed(0, 241) then -- Scrollup
fov = math.max(fov - zoomspeed, fov_min)
end
if IsControlJustPressed(0, 242) then
fov = math.min(fov + zoomspeed, fov_max) -- ScrollDown
end
local current_fov = GetCamFov(cam)
if math.abs(fov - current_fov) < 0.1 then fov = current_fov end
if math.abs(fov-current_fov) < 0.1 then
fov = current_fov
end
SetCamFov(cam, current_fov + (fov - current_fov) * 0.05)
else
if IsControlJustPressed(0, 17) then fov = math.max(fov - zoomspeed, fov_min) end -- scrollup
if IsControlJustPressed(0, 16) then fov = math.min(fov + zoomspeed, fov_max) end -- scrolldown
if IsControlJustPressed(0, 17) then -- Scrollup
fov = math.max(fov - zoomspeed, fov_min)
end
if IsControlJustPressed(0, 16) then
fov = math.min(fov + zoomspeed, fov_max) -- ScrollDown
end
local current_fov = GetCamFov(cam)
if math.abs(fov - current_fov) < 0.1 then fov = current_fov end -- the difference is too small, just set the value directly to avoid unneeded updates to FOV of order 10^-5
SetCamFov(cam, current_fov + (fov - current_fov) * 0.05) -- smoothing of camera zoom
if math.abs(fov-current_fov) < 0.1 then -- the difference is too small, just set the value directly to avoid unneeded updates to FOV of order 10^-5
fov = current_fov
end
SetCamFov(cam, current_fov + (fov - current_fov) * 0.05) -- Smoothing of camera zoom
end
end

-- Events
--EVENTS--

-- Activate binoculars
local cam = nil
local scaleform = nil
RegisterNetEvent('binoculars:Toggle', function()
if cache.vehicle then return end
binoculars = not binoculars
Expand All @@ -61,6 +75,7 @@ RegisterNetEvent('binoculars:Toggle', function()
while binoculars do

scaleform = lib.requestScaleformMovie('BINOCULARS')

BeginScaleformMovieMethod(scaleform, 'SET_CAM_LOGO')
ScaleformMovieMethodAddParamInt(0) -- 0 for nothing, 1 for LSPD logo
EndScaleformMovieMethod()
Expand Down
2 changes: 1 addition & 1 deletion client/consumables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ RegisterNetEvent('consumables:client:meth', function()
TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items['meth'], 'remove')
TriggerEvent('evidence:client:SetStatus', 'widepupils', 300)
TriggerEvent('evidence:client:SetStatus', 'agitated', 300)
MethBagEffect()
methBagEffect()
else -- if canceled
QBCore.Functions.Notify('Canceled...', 'error')
end
Expand Down
4 changes: 2 additions & 2 deletions client/vehicletext.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ CreateThread(function()
else
text = v.name
end
if v.hash and v.hash ~= 0 then
if v.hash ~= 0 and v.hash ~= nil then
AddTextEntryByHash(v.hash, text)
end
end
end)
end)

0 comments on commit 00f8351

Please sign in to comment.