@@ -235,6 +235,7 @@ local activeBlips = {}
235235deleteVehicleBlip  =  function (netId )
236236	if  not  activeBlips [netId ] then  return  end 
237237	RemoveBlip (activeBlips [netId ].blip )
238+ 	activeBlips [netId ] =  nil 
238239end 
239240RegisterNetEvent (' msk_enginetoggle:deleteVehicleBlip' deleteVehicleBlip )
240241
@@ -265,22 +266,28 @@ showVehicleBlip = function(netId, coords)
265266		activeBlips [netId ].isActive  =  false 
266267		ShowHeadingIndicatorOnBlip (activeBlips [netId ].blip , false )
267268		SetBlipCoords (activeBlips [netId ].blip , coords .x , coords .y , coords .z )
268- 	elseif  OneSync  and  not  activeBlips [netId ].isActive  then 
269+ 	elseif  OneSync  and  activeBlips [ netId ]  and   not  activeBlips [netId ].isActive  then 
269270		CreateThread (function ()
270271			activeBlips [netId ].isActive  =  true 
271272
272- 			while  activeBlips [netId ] and  activeBlips [netId ].isActive  and  DoesEntityExist (OneSync .vehicle ) do 
273- 				local  vehicleCoords  =  GetEntityCoords (OneSync .vehicle )
274- 				local  heading  =  math.ceil (GetEntityHeading (OneSync .vehicle ))
275- 
276- 				SetBlipCoords (activeBlips [netId ].blip , vehicleCoords .x , vehicleCoords .y , vehicleCoords .z )
277- 				ShowHeadingIndicatorOnBlip (activeBlips [netId ].blip , true )
278- 				SetBlipRotation (activeBlips [netId ].blip , heading )
273+ 			while  activeBlips [netId ] and  activeBlips [netId ].isActive  do 
274+ 				if  DoesEntityExist (OneSync .vehicle ) then 
275+ 					local  vehicleCoords  =  GetEntityCoords (OneSync .vehicle )
276+ 					local  heading  =  math.ceil (GetEntityHeading (OneSync .vehicle ))
277+ 
278+ 					SetBlipCoords (activeBlips [netId ].blip , vehicleCoords .x , vehicleCoords .y , vehicleCoords .z )
279+ 					ShowHeadingIndicatorOnBlip (activeBlips [netId ].blip , true )
280+ 					SetBlipRotation (activeBlips [netId ].blip , heading )
281+ 				else 
282+ 					deleteVehicleBlip (netId )
283+ 					break 
284+ 				end 
279285			end 
280286		end )
281287	end 
282288
283289	SetTimeout (2500 , function ()
290+ 		if  not  activeBlips [netId ] then  return  end 
284291		showVehicleBlip (netId , coords )
285292	end )
286293end 
0 commit comments