Skip to content

Commit 10f8a77

Browse files
committed
Add limiters to stop spamming targets
Completely missed that you could get away with targetting things more than once while progressbar is running to trigger it more than once this doesn't allow things to be triggered more than once
1 parent 76a3a6f commit 10f8a77

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

client/client.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,14 @@ Recycling.PickUpPackage.PickRandomEntity = function(Trolly)
311311
} }, 2.5 )
312312
end
313313

314+
local Picking = false
314315
Recycling.PickUpPackage.startPickup = function(data)
316+
if Picking then
317+
triggerNotify(nil, "No", "error")
318+
return
319+
else
320+
Picking = true
321+
end
315322
local Ped = PlayerPedId()
316323
TaskStartScenarioInPlace(Ped, "CODE_HUMAN_MEDIC_KNEEL", 0, true)
317324
if progressBar({
@@ -323,6 +330,7 @@ Recycling.PickUpPackage.startPickup = function(data)
323330
ClearPedTasksImmediately(Ped)
324331
Recycling.PickUpPackage.holdItem(data)
325332
end
333+
Picking = false
326334
end
327335

328336
-- Pick up prop and remove target from current location
@@ -361,7 +369,14 @@ Recycling.PickUpPackage.holdItem = function(data)
361369
} }, 2.5)
362370
end
363371

372+
local CollectingReward = false
364373
Recycling.PickUpPackage.collectReward = function(data)
374+
if CollectingReward then
375+
triggerNotify(nil, "No", "error")
376+
return
377+
else
378+
CollectingReward = true
379+
end
365380
local Ped = PlayerPedId()
366381
lookEnt(TrollyProp)
367382
playAnim("mp_car_bomb", "car_bomb_mechanic", -1, 1, Ped)
@@ -388,6 +403,7 @@ Recycling.PickUpPackage.collectReward = function(data)
388403
addItem("recyclablematerial", math.random(Config.Other.RecycleAmounts["Recycle"].Min, Config.Other.RecycleAmounts["Recycle"].Max))
389404
Recycling.PickUpPackage.PickRandomEntity(data.Trolly)
390405
end
406+
CollectingReward = false
391407
end
392408

393409
Recycling.Functions.dutyToggle = function(data)

0 commit comments

Comments
 (0)