added a lot
moved some functions around, added better ox inv options so no longer requires items in qb-core changed call backs to oxlib callbacks cried twice added new func
This commit is contained in:
1 parent
5448eabd87
commit
b6b4776ab2
16 files changed
+156
-110
No files matched your search
@@ -9,12 +9,11 @@ function Cornersell()
|
||||
TaskGoToCoordAnyMeans(targ, GetEntityCoords(PlayerPedId()), 1.0, 0, 0, 0, 0)
|
||||
repeat
|
||||
Wait(1000)
|
||||
|
||||
until #(GetEntityCoords(PlayerPedId()) - GetEntityCoords(targ)) < 2.0
|
||||
lib.requestAnimDict("rcmme_tracey1")
|
||||
TaskStartScenarioInPlace(targ, "WORLD_HUMAN_STAND_IMPATIENT_UPRIGHT", 0, false)
|
||||
FreezeEntityPosition(targ, true)
|
||||
QBCore.Functions.TriggerCallback('md-drugs:server:cornerselling:getAvailableDrugs', function(item, amount)
|
||||
local item, amount = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false)
|
||||
if item == 'nothing' then Notify(' You Aint Got Shit', 'error') sell = false FreezeEntityPosition(targ, false) ClearPedTasks(targ) return false end
|
||||
local bagAmount = math.random(1, amount)
|
||||
if bagAmount > 15 then bagAmount = math.random(1,15) end
|
||||
@@ -22,7 +21,7 @@ function Cornersell()
|
||||
local price = math.random(table['min'], table['max'] ) * bagAmount
|
||||
local targbusy = false
|
||||
local options = {
|
||||
{ label = 'Sell ' .. bagAmount .. ' Of ' .. QBCore.Shared.Items[item].label .. ' For $' .. price .. '!', icon = "fas fa-eye",
|
||||
{ label = 'Sell ' .. bagAmount .. ' Of ' .. GetLabel(item) .. ' For $' .. price .. '!', icon = "fas fa-eye",
|
||||
onSelect = function()
|
||||
PoliceCall(20)
|
||||
targbusy = true
|
||||
@@ -36,7 +35,7 @@ function Cornersell()
|
||||
sold = true
|
||||
sell = false
|
||||
return end
|
||||
if not progressbar('Selling ' .. QBCore.Shared.Items[item].label .. '!', 4000, 'uncuff') then return end
|
||||
if not progressbar('Selling ' .. GetLabel(item) .. '!', 4000, 'uncuff') then return end
|
||||
TriggerServerEvent('md-drugs:server:sellCornerDrugs', item, bagAmount, price)
|
||||
FreezeEntityPosition(targ, false)
|
||||
ClearPedTasks(targ)
|
||||
@@ -68,7 +67,7 @@ function Cornersell()
|
||||
},
|
||||
}
|
||||
local optionsqb = {
|
||||
{ label = 'Sell ' .. bagAmount .. ' Of ' .. QBCore.Shared.Items[item].label .. ' For $' .. price .. '!', icon = "fas fa-eye",
|
||||
{ label = 'Sell ' .. bagAmount .. ' Of ' .. GetLabel(item) .. ' For $' .. price .. '!', icon = "fas fa-eye",
|
||||
action = function()
|
||||
PoliceCall(20)
|
||||
targbusy = true
|
||||
@@ -82,7 +81,7 @@ function Cornersell()
|
||||
sold = true
|
||||
sell = false
|
||||
return end
|
||||
if not progressbar('Selling ' .. QBCore.Shared.Items[item].label .. '!', 4000, 'uncuff') then return end
|
||||
if not progressbar('Selling ' .. GetLabel(item) .. '!', 4000, 'uncuff') then return end
|
||||
TriggerServerEvent('md-drugs:server:sellCornerDrugs', item, bagAmount, price)
|
||||
FreezeEntityPosition(targ, false)
|
||||
ClearPedTasks(targ)
|
||||
@@ -118,7 +117,6 @@ function Cornersell()
|
||||
else
|
||||
exports['qb-target']:AddTargetEntity(targ, { options = optionsqb, distance = 2.0})
|
||||
end
|
||||
end)
|
||||
repeat
|
||||
Wait(1000)
|
||||
until sold
|
||||
@@ -127,7 +125,7 @@ end
|
||||
|
||||
RegisterNetEvent('md-drugs:client:cornerselling', function()
|
||||
if not GetCops(QBConfig.MinimumDrugSalePolice) then return end
|
||||
QBCore.Functions.TriggerCallback('md-drugs:server:cornerselling:getAvailableDrugs', function(item, amount)
|
||||
local item, amount = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false)
|
||||
if item ~= 'nothing' then
|
||||
if sell then
|
||||
Notify('Lazy Ass Cant Even Sell Drugs', 'error')
|
||||
@@ -143,5 +141,5 @@ RegisterNetEvent('md-drugs:client:cornerselling', function()
|
||||
else
|
||||
Notify('You Cant Sell Air', 'error')
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in new issue
Block a user