From 2197056be522f0c5daadab230ed483dff782e74c Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 8 Nov 2019 16:07:38 +0000 Subject: [PATCH] Added create thread back in Works better now as the system doesn't run every frame like it used to --- cl_radar.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/cl_radar.lua b/cl_radar.lua index c32c176..834053d 100644 --- a/cl_radar.lua +++ b/cl_radar.lua @@ -366,17 +366,19 @@ function RADAR:GetVehsHitByRay( ownVeh, vehs, s, e ) end function RADAR:CreateRayThread( vehs, from, startX, endX, endY ) - local startP = GetOffsetFromEntityInWorldCoords( from, startX, 0.0, 0.0 ) - local endP = GetOffsetFromEntityInWorldCoords( from, endX, endY, 0.0 ) + Citizen.CreateThread( function() + local startP = GetOffsetFromEntityInWorldCoords( from, startX, 0.0, 0.0 ) + local endP = GetOffsetFromEntityInWorldCoords( from, endX, endY, 0.0 ) - UTIL:DrawDebugLine( startP, endP ) + UTIL:DrawDebugLine( startP, endP ) - local hitVehs = self:GetVehsHitByRay( from, vehs, startP, endP ) + local hitVehs = self:GetVehsHitByRay( from, vehs, startP, endP ) - self:InsertCapturedVehicleData( hitVehs ) + self:InsertCapturedVehicleData( hitVehs ) - print( "Ray thread: increasing ray state from " .. tostring( self:GetRayTraceState() ) .. " to " .. tostring( self:GetRayTraceState() + 1 ) ) - self:IncreaseRayTraceState() + print( "Ray thread: increasing ray state from " .. tostring( self:GetRayTraceState() ) .. " to " .. tostring( self:GetRayTraceState() + 1 ) ) + self:IncreaseRayTraceState() + end ) end function RADAR:RunControlManager()