added ped walk away feature if you dont cornersell to them fast enough
This commit is contained in:
1 parent
c349563ef3
commit
c37b777748
2 files changed
+18
-3
No files matched your search
@@ -8,10 +8,22 @@ local active = false
|
|||||||
local function reset(targ)
|
local function reset(targ)
|
||||||
FreezeEntityPosition(targ, false)
|
FreezeEntityPosition(targ, false)
|
||||||
ClearPedTasks(targ)
|
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)
|
Wait(10000)
|
||||||
DeletePed(targ)
|
DeletePed(targ)
|
||||||
targbusy = false
|
targbusy = false
|
||||||
sold = true
|
|
||||||
active = false
|
active = false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -59,10 +71,13 @@ function Cornersell()
|
|||||||
canInteract = function()
|
canInteract = function()
|
||||||
if not targbusy then return true end end,
|
if not targbusy then return true end end,
|
||||||
}}, nil)
|
}}, nil)
|
||||||
|
local timer = 45
|
||||||
repeat
|
repeat
|
||||||
Wait(1000)
|
Wait(1000)
|
||||||
until sold
|
timer = timer - 1
|
||||||
|
until sold or timer == 0
|
||||||
if sold then sold = false return true end
|
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
|
end
|
||||||
|
|
||||||
RegisterNetEvent('md-drugs:client:cornerselling', function()
|
RegisterNetEvent('md-drugs:client:cornerselling', function()
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price
|
|||||||
worth = price
|
worth = price
|
||||||
}
|
}
|
||||||
Player.Functions.AddItem('markedbills', 1, false, info )
|
Player.Functions.AddItem('markedbills', 1, false, info )
|
||||||
elseif QBConfig.CustomDirtyMoney then
|
elseif QBConfig.CustomDirtyMoney == true then
|
||||||
AddItem(src, QBConfig.CustomDirtyMoneyitem, price)
|
AddItem(src, QBConfig.CustomDirtyMoneyitem, price)
|
||||||
else
|
else
|
||||||
Player.Functions.AddMoney('cash', price)
|
Player.Functions.AddMoney('cash', price)
|
||||||
|
|||||||
Reference in new issue
Block a user