Skip to content

Commit

Permalink
fix(client/main): disable spotlight if you arent in the correct seats
Browse files Browse the repository at this point in the history
  • Loading branch information
mafewtm committed Dec 14, 2024
1 parent df3c22e commit 8f5ac87
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,17 @@ AddStateBagChangeHandler('spotlight', nil, function(bagName, _, value)
end)

lib.onCache('seat', function(seat)
if not cache.vehicle then return end
if seat ~= -1 and seat ~= 0 then
spotlight:disable(true)
return
end

local model = GetEntityModel(cache.vehicle)

if not config.policeHelicopters[model] or (seat ~= -1 and seat ~= 0) then return end
if not config.policeHelicopters[model] then return end

if DoesVehicleHaveSearchlight(cache.vehicle) then
spotlight:disable(not cache.vehicle)
spotlight:disable(false)
end

CreateThread(function()
Expand Down

0 comments on commit 8f5ac87

Please sign in to comment.