Plate reader only scans when it "sees" the front or rear

This commit is contained in:
Dan
2020-02-19 14:13:01 +00:00
parent 11fcb20061
commit 16c59802fc

View File

@@ -173,6 +173,15 @@ function READER:Main()
-- Only proceed to read a plate if the hit entity is a valid vehicle and the current camera isn't locked
if ( DoesEntityExist( veh ) and IsEntityAVehicle( veh ) and not self:GetCamLocked( cam ) ) then
-- Get the heading of the player's vehicle and the hit vehicle
local ownH = UTIL:Round( GetEntityHeading( PLY.veh ), 0 )
local tarH = UTIL:Round( GetEntityHeading( veh ), 0 )
-- Get the relative direction between the player's vehicle and the hit vehicle
local dir = UTIL:GetEntityRelativeDirection( ownH, tarH )
-- Only run the rest of the plate check code if we can see the front or rear of the vehicle
if ( dir > 0 ) then
-- Get the licence plate text from the vehicle
local plate = GetVehicleNumberPlateText( veh )
@@ -205,6 +214,7 @@ function READER:Main()
end
end
end
end
-- Main thread
Citizen.CreateThread( function()