mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 08:26:27 +02:00
Plate reader only scans when it "sees" the front or rear
This commit is contained in:
@@ -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
|
-- 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
|
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
|
-- Get the licence plate text from the vehicle
|
||||||
local plate = GetVehicleNumberPlateText( veh )
|
local plate = GetVehicleNumberPlateText( veh )
|
||||||
|
|
||||||
@@ -205,6 +214,7 @@ function READER:Main()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Main thread
|
-- Main thread
|
||||||
Citizen.CreateThread( function()
|
Citizen.CreateThread( function()
|
||||||
|
|||||||
Reference in New Issue
Block a user