Skip to content

Commit ad4868d

Browse files
committed
Add toggles for outlines and blips when recycling
Many users report that they crash when an debug outline is created and they use `QuantV` graphics. Ive added toggle for the new blip system that shows when targeting and a toggle to disable the outlines for all users to prevent crashes
1 parent 9c859e7 commit ad4868d

File tree

2 files changed

+50
-30
lines changed

2 files changed

+50
-30
lines changed

client/client.lua

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,10 @@ Recycling.Functions.EndJob = function()
227227
destroyProp(TrollyProp)
228228
TrollyProp = nil
229229
end
230-
for i = 1, #searchProps do
231-
SetEntityDrawOutline(searchProps[i], false)
230+
if Config.Main.useLineHighlight then
231+
for i = 1, #searchProps do
232+
SetEntityDrawOutline(searchProps[i], false)
233+
end
232234
end
233235
randPackage = nil
234236
if scrapProp then
@@ -257,7 +259,7 @@ Recycling.Functions.CleanUpProps = function()
257259
end
258260
unloadModel(GetEntityModel(TrollyProp))
259261
DeleteObject(TrollyProp)
260-
if targetBlip ~= nil and DoesBlipExist(targetBlip) then
262+
if Config.Main.useblipTarget and targetBlip ~= nil and DoesBlipExist(targetBlip) then
261263
RemoveBlip(targetBlip)
262264
targetBlip = nil
263265
end
@@ -309,9 +311,12 @@ Recycling.PickUpPackage.PickRandomEntity = function(Trolly)
309311
end
310312
--Pick random prop to use
311313
randPackage = searchProps[math.random(1, #searchProps)]
312-
SetEntityDrawOutline(randPackage, true)
313-
SetEntityDrawOutlineColor(0, 255, 0, 1.0)
314-
SetEntityDrawOutlineShader(1)
314+
315+
if Config.Main.useLineHighlight then
316+
SetEntityDrawOutline(randPackage, true)
317+
SetEntityDrawOutlineColor(0, 255, 0, 1.0)
318+
SetEntityDrawOutlineShader(1)
319+
end
315320
--Generate Target Location on the selected package
316321

317322
Targets["Package"] =
@@ -325,14 +330,15 @@ Recycling.PickUpPackage.PickRandomEntity = function(Trolly)
325330
return not Picking
326331
end,
327332
} }, 2.5 )
328-
329-
targetBlip = makeBlip({
330-
name = locale("target", "search"),
331-
coords = GetEntityCoords(randPackage),
332-
sprite = 12,
333-
col = 2,
334-
scale = 0.6,
335-
})
333+
if Config.Main.useblipTarget then
334+
targetBlip = makeBlip({
335+
name = locale("target", "search"),
336+
coords = GetEntityCoords(randPackage),
337+
sprite = 12,
338+
col = 2,
339+
scale = 0.6,
340+
})
341+
end
336342
end
337343

338344
Recycling.PickUpPackage.startPickup = function(data)
@@ -365,8 +371,10 @@ Recycling.PickUpPackage.holdItem = function(data)
365371
SetEntityDrawOutline(randPackage, false)
366372
randPackage = nil
367373

368-
RemoveBlip(targetBlip)
369-
targetBlip = nil
374+
if Config.Main.useblipTarget then
375+
RemoveBlip(targetBlip)
376+
targetBlip = nil
377+
end
370378

371379
--Make prop to put in hands
372380
playAnim("anim@heists@box_carry@", "idle", -1, 50, Ped)
@@ -382,9 +390,12 @@ Recycling.PickUpPackage.holdItem = function(data)
382390

383391
debugPrint("^5Debug^7: ^2Adding target and outline to ^3TrollyProp^7: ", TrollyProp)
384392
--Create target for drop off location
385-
SetEntityDrawOutline(TrollyProp, true)
386-
SetEntityDrawOutlineColor(150, 1, 1, 1.0)
387-
SetEntityDrawOutlineShader(1)
393+
394+
if Config.Main.useLineHighlight then
395+
SetEntityDrawOutline(TrollyProp, true)
396+
SetEntityDrawOutlineColor(150, 1, 1, 1.0)
397+
SetEntityDrawOutlineShader(1)
398+
end
388399

389400
createEntityTarget(TrollyProp, { {
390401
action = function()
@@ -396,14 +407,15 @@ Recycling.PickUpPackage.holdItem = function(data)
396407
return not CollectingReward
397408
end
398409
} }, 2.5)
399-
400-
targetBlip = makeBlip({
401-
name = locale("target", "drop_off"),
402-
coords = GetEntityCoords(TrollyProp),
403-
sprite = 12,
404-
col = 1,
405-
scale = 0.6,
406-
})
410+
if Config.Main.useblipTarget then
411+
targetBlip = makeBlip({
412+
name = locale("target", "drop_off"),
413+
coords = GetEntityCoords(TrollyProp),
414+
sprite = 12,
415+
col = 1,
416+
scale = 0.6,
417+
})
418+
end
407419
end
408420

409421
Recycling.PickUpPackage.collectReward = function(data)
@@ -426,16 +438,20 @@ Recycling.PickUpPackage.collectReward = function(data)
426438
debugPrint("^5Debug^7: ^2Clearing target and outline from ^3TrollyProp^7, ", TrollyProp)
427439
removeEntityTarget(TrollyProp)
428440
destroyProp(TrollyProp)
429-
SetEntityDrawOutline(TrollyProp, false)
441+
if Config.Main.useLineHighlight then
442+
SetEntityDrawOutline(TrollyProp, false)
443+
end
430444
TrollyProp = nil
431445
TrollyProp = makeProp(data.Trolly, 1, 0)
432446

433447
--Empty hands
434448
destroyProp(scrapProp)
435449
scrapProp = nil
436450

437-
RemoveBlip(targetBlip)
438-
targetBlip = nil
451+
if Config.Main.useblipTarget then
452+
RemoveBlip(targetBlip)
453+
targetBlip = nil
454+
end
439455

440456
stopAnim("mp_car_bomb", "car_bomb_mechanic", Ped)
441457
currentToken = triggerCallback(AuthEvent)

config.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Config = {
1515

1616
useSkillCheck = true,
1717
},
18+
Main = {
19+
useLineHighlight = true, -- Renders outlines for recycle targets, set this to false if you have users crashing due to QuantV
20+
useblipTarget = true, -- Shows small blips for recycle targets, set this to false to disable these
21+
},
1822
Crafting = {
1923
showItemBox = true,
2024
},

0 commit comments

Comments
 (0)