From c37b7777487695ba89700fc6b80cf2d0a7f1a8f6 Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Mon, 25 Nov 2024 01:46:26 -0800 Subject: [PATCH] added ped walk away feature if you dont cornersell to them fast enough --- client/cornerselling.lua | 19 +++++++++++++++++-- server/cornerselling.lua | 4 ++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/client/cornerselling.lua b/client/cornerselling.lua index 9235d75..2b89fe2 100644 --- a/client/cornerselling.lua +++ b/client/cornerselling.lua @@ -8,10 +8,22 @@ local active = false local function reset(targ) FreezeEntityPosition(targ, false) ClearPedTasks(targ) + local coords = GetEntityCoords(targ) + TaskWanderInArea(targ, coords.x, coords.y, coords.z, 100.0, 2, 10.0) + Wait(10000) + DeletePed(targ) + sold = true + active = false +end + +local function walkAway(targ) + FreezeEntityPosition(targ, false) + ClearPedTasks(targ) + local coords = GetEntityCoords(targ) + TaskWanderInArea(targ, coords.x, coords.y, coords.z, 100.0, 2, 10.0) Wait(10000) DeletePed(targ) targbusy = false - sold = true active = false end @@ -59,10 +71,13 @@ function Cornersell() canInteract = function() if not targbusy then return true end end, }}, nil) + local timer = 45 repeat Wait(1000) - until sold + timer = timer - 1 + until sold or timer == 0 if sold then sold = false return true end + if timer == 0 then Notify(Lang.Cornerselling.timeout, 'error') targbusy = true walkAway(targ) return false end end RegisterNetEvent('md-drugs:client:cornerselling', function() diff --git a/server/cornerselling.lua b/server/cornerselling.lua index 33424ab..ac8c2c3 100644 --- a/server/cornerselling.lua +++ b/server/cornerselling.lua @@ -159,7 +159,7 @@ RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price local src = source local Player = getPlayer(src) local isIn = false - for k, v in pairs (Drugs) do + for k, v in pairs (Drugs) do if item == k then isIn = true end @@ -176,7 +176,7 @@ RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price worth = price } Player.Functions.AddItem('markedbills', 1, false, info ) - elseif QBConfig.CustomDirtyMoney then + elseif QBConfig.CustomDirtyMoney == true then AddItem(src, QBConfig.CustomDirtyMoneyitem, price) else Player.Functions.AddMoney('cash', price)