@@ -41,9 +41,12 @@ toggleLockpick = function()
4141 end
4242
4343 if alarmStage .liveCoords and owner then
44- TriggerServerEvent (' msk_enginetoggle:liveCoords' , owner , NetworkGetNetworkIdFromEntity (vehicle ), GetEntityCoords (vehicle ))
44+ TriggerServerEvent (' msk_enginetoggle:liveCoords' , owner , VehToNet (vehicle ), GetEntityCoords (vehicle ))
4545 end
4646
47+ local debug = false
48+ if not debug then return end
49+
4750 MSK .LoadAnimDict (animation .dict )
4851 TaskPlayAnim (playerPed , animation .dict , animation .anim , 8.0 , 1.0 , - 1 , 49 , 0 , false , false , false )
4952 FreezeEntityPosition (playerPed , true )
226229inOneSync = function (netId )
227230 local vehicle = NetworkDoesNetworkIdExist (netId ) and NetworkGetEntityFromNetworkId (netId )
228231
229- if DoesEntityExist (vehicle ) then return {vehicle = vehicle } end
232+ if DoesEntityExist (vehicle ) then
233+ return {vehicle = vehicle }
234+ end
230235 return false
231236end
232237
@@ -239,51 +244,46 @@ deleteVehicleBlip = function(netId)
239244end
240245RegisterNetEvent (' msk_enginetoggle:deleteVehicleBlip' , deleteVehicleBlip )
241246
242- showVehicleBlip = function (netId , coords )
243- local OneSync = inOneSync ( netId )
247+ addVehicleBlip = function (netId , coords )
248+ local blip = AddBlipForCoord ( coords . x , coords . y , coords . z )
244249
245- if not activeBlips [netId ] then
246- local blip = AddBlipForCoord (coords .x , coords .y , coords .z )
250+ SetBlipSprite (blip , 326 )
251+ SetBlipDisplay (blip , 2 )
252+ SetBlipColour (blip , 1 )
253+ SetBlipScale (blip , 1.0 )
254+ SetBlipFlashes (blip , true )
255+ SetBlipAsShortRange (blip , false )
247256
248- SetBlipSprite (blip , 326 )
249- SetBlipDisplay (blip , 2 )
250- SetBlipColour (blip , 1 )
251- SetBlipScale (blip , 1.0 )
252- SetBlipFlashes (blip , true )
253- SetBlipAsShortRange (blip , false )
257+ BeginTextCommandSetBlipName (' STRING' )
258+ AddTextComponentString (Translation [Config .Locale ][' blip_stolen_vehicle' ])
259+ EndTextCommandSetBlipName (blip )
254260
255- BeginTextCommandSetBlipName (' STRING' )
256- AddTextComponentString (Translation [Config .Locale ][' blip_stolen_vehicle' ])
257- EndTextCommandSetBlipName (blip )
261+ activeBlips [netId ] = {isActive = false , blip = blip }
262+ end
258263
259- activeBlips [netId ] = {
260- isActive = false ,
261- blip = blip
262- }
263- end
264+ showVehicleBlip = function (netId , coords )
265+ if not activeBlips [netId ] then addVehicleBlip (netId , coords ) end
266+ local OneSync = inOneSync (netId )
264267
265- if not OneSync and activeBlips [netId ] then
266- activeBlips [netId ].isActive = false
267- ShowHeadingIndicatorOnBlip (activeBlips [netId ].blip , false )
268- SetBlipCoords (activeBlips [netId ].blip , coords .x , coords .y , coords .z )
269- elseif OneSync and activeBlips [netId ] and not activeBlips [netId ].isActive then
268+ if OneSync and activeBlips [netId ] and not activeBlips [netId ].isActive then
270269 CreateThread (function ()
271270 activeBlips [netId ].isActive = true
272271
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
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 )
279+
280+ Wait (0 )
285281 end
286282 end )
283+ elseif not OneSync and activeBlips [netId ] then
284+ activeBlips [netId ].isActive = false
285+ SetBlipCoords (activeBlips [netId ].blip , coords .x , coords .y , coords .z )
286+ ShowHeadingIndicatorOnBlip (activeBlips [netId ].blip , false )
287287 end
288288
289289 SetTimeout (2500 , function ()
0 commit comments