11onDuty , Peds , Targets , searchProps , Props , randPackage = false , {}, {}, {}, {}, nil
22local TrollyProp = nil
3+ local CollectingReward = false
4+ local Picking = false
5+ local targetBlip = nil
36
47Recycling = {
58 Functions = {},
@@ -25,7 +28,7 @@ onPlayerLoaded(function()
2528 Recycling .Functions .CleanUpProps ()
2629 debugPrint (" ^5Debug^7: ^3PolyZone^7: ^2Leaving Area^7. ^2Clocking out and cleaning up^7" )
2730 if loc .Job then
28- if onDuty then TriggerServerEvent ( " QBCore:ToggleDuty " ) end
31+ if onDuty then toggleDuty ( ) end
2932 elseif onDuty == true then
3033 onDuty = false
3134 end
@@ -198,10 +201,12 @@ Recycling.Functions.createProps = function(location)
198201 }, 1 , 0 )
199202 end
200203 for i = 1 , # loc .ExtraPropLocations do
204+ if math.random (1 , 2 ) == 1 then goto skip end
201205 Props [# Props + 1 ] = makeProp ({
202206 prop = Config .RecyclingCenter .propTable [math.random (1 , # Config .RecyclingCenter .propTable )],
203207 coords = loc .ExtraPropLocations [i ] - vec4 (0 , 0 , 1.03 , 0 )
204208 }, 1 , 0 )
209+ :: skip::
205210 end
206211 for k in pairs (Config .RecyclingCenter .scrapPool ) do
207212 loadModel (Config .RecyclingCenter .scrapPool [k ].model )
@@ -249,6 +254,10 @@ Recycling.Functions.CleanUpProps = function()
249254 end
250255 unloadModel (GetEntityModel (TrollyProp ))
251256 DeleteObject (TrollyProp )
257+ if targetBlip ~= nil and DoesBlipExist (targetBlip ) then
258+ RemoveBlip (targetBlip )
259+ targetBlip = nil
260+ end
252261end
253262
254263
@@ -301,17 +310,28 @@ Recycling.PickUpPackage.PickRandomEntity = function(Trolly)
301310 SetEntityDrawOutlineColor (0 , 255 , 0 , 1.0 )
302311 SetEntityDrawOutlineShader (1 )
303312 -- Generate Target Location on the selected package
313+
304314 Targets [" Package" ] =
305315 createEntityTarget (randPackage , { {
306316 action = function ()
307317 Recycling .PickUpPackage .startPickup ({ Trolly = Trolly })
308318 end ,
309319 icon = ' fas fa-magnifying-glass' ,
310320 label = locale (" target" , " search" ),
321+ canInteract = function ()
322+ return not Picking
323+ end ,
311324 } }, 2.5 )
325+
326+ targetBlip = makeBlip ({
327+ name = locale (" target" , " search" ),
328+ coords = GetEntityCoords (randPackage ),
329+ sprite = 12 ,
330+ col = 2 ,
331+ scale = 0.6 ,
332+ })
312333end
313334
314- local Picking = false
315335Recycling .PickUpPackage .startPickup = function (data )
316336 if Picking then
317337 triggerNotify (nil , " No" , " error" )
@@ -342,6 +362,9 @@ Recycling.PickUpPackage.holdItem = function(data)
342362 SetEntityDrawOutline (randPackage , false )
343363 randPackage = nil
344364
365+ RemoveBlip (targetBlip )
366+ targetBlip = nil
367+
345368 -- Make prop to put in hands
346369 playAnim (" anim@heists@box_carry@" , " idle" , - 1 , 50 , Ped )
347370
@@ -366,10 +389,20 @@ Recycling.PickUpPackage.holdItem = function(data)
366389 end ,
367390 icon = ' fas fa-recycle' ,
368391 label = locale (" target" , " drop_off" ),
392+ canInteract = function ()
393+ return not CollectingReward
394+ end
369395 } }, 2.5 )
396+
397+ targetBlip = makeBlip ({
398+ name = locale (" target" , " drop_off" ),
399+ coords = GetEntityCoords (TrollyProp ),
400+ sprite = 12 ,
401+ col = 1 ,
402+ scale = 0.6 ,
403+ })
370404end
371405
372- local CollectingReward = false
373406Recycling .PickUpPackage .collectReward = function (data )
374407 if CollectingReward then
375408 triggerNotify (nil , " No" , " error" )
@@ -398,6 +431,9 @@ Recycling.PickUpPackage.collectReward = function(data)
398431 destroyProp (scrapProp )
399432 scrapProp = nil
400433
434+ RemoveBlip (targetBlip )
435+ targetBlip = nil
436+
401437 stopAnim (" mp_car_bomb" , " car_bomb_mechanic" , Ped )
402438 currentToken = triggerCallback (AuthEvent )
403439 addItem (" recyclablematerial" , math.random (Config .Other .RecycleAmounts [" Recycle" ].Min , Config .Other .RecycleAmounts [" Recycle" ].Max ))
0 commit comments