big update. i prob broke something, let me know in discord

This commit is contained in:
Mustache Dom authored and GitHub committed 2024-09-24 15:07:41 -07:00
1 parent 009b0a4f4a
commit 028c5f771f
42 files changed
+2042 -3056

No files matched your search

+54 -97
View File
@@ -1,11 +1,47 @@
local QBCore = exports['qb-core']:GetCoreObject()
local sell = false
local sold = false
local targbusy = false
local function sellDrug(item, amount, price, targ)
PoliceCall(20)
targbusy = true
if IsPedInAnyVehicle(PlayerPedId(), true) then
Notify('STRANGER DANGER, I WONT GET IN THE CAR WITH YOU', 'error')
FreezeEntityPosition(targ, false)
ClearPedTasks(targ)
Wait(10000)
DeletePed(targ)
targbusy = false
sold = true
sell = false
return end
if not progressbar('Selling ' .. GetLabel(item) .. '!', 4000, 'uncuff') then return end
TriggerServerEvent('md-drugs:server:sellCornerDrugs', item, amount, price)
FreezeEntityPosition(targ, false)
ClearPedTasks(targ)
Wait(10000)
DeletePed(targ)
targbusy = false
sold = true
end
local function deny(targ)
PoliceCall(20)
targbusy = true
if not progressbar('Telling This Dumbass To Leave!', 4000, 'argue5') then return end
FreezeEntityPosition(targ, false)
ClearPedTasks(targ)
Wait(10000)
DeletePed(targ)
targbusy = false
sold = true
end
function Cornersell()
local targ = lib.GetClosestPed(GetEntityCoords(PlayerPedId()), 8)
if targ == nil then return end
if IsPedInAnyVehicle(targ, false) or GetEntityHealth(targ) == 0 then return end
local sold = false
if IsPedInAnyVehicle(targ, false) or GetEntityHealth(targ) == 0 or not IsPedHuman(targ) then return end
TaskGoToCoordAnyMeans(targ, GetEntityCoords(PlayerPedId()), 1.0, 0, 0, 0, 0)
repeat
Wait(1000)
@@ -13,110 +49,31 @@ function Cornersell()
lib.requestAnimDict("rcmme_tracey1")
TaskStartScenarioInPlace(targ, "WORLD_HUMAN_STAND_IMPATIENT_UPRIGHT", 0, false)
FreezeEntityPosition(targ, true)
local item, amount = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false)
local item, amount, price = 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
local table = QBConfig.DrugsPrice[item]
local price = math.random(table['min'], table['max'] ) * bagAmount
local targbusy = false
local options = {
{ label = 'Sell ' .. bagAmount .. ' Of ' .. GetLabel(item) .. ' For $' .. price .. '!', icon = "fas fa-eye",
onSelect = function()
PoliceCall(20)
targbusy = true
if IsPedInAnyVehicle(PlayerPedId(), true) then
Notify('STRANGER DANGER, I WONT GET IN THE CAR WITH YOU', 'error')
FreezeEntityPosition(targ, false)
ClearPedTasks(targ)
Wait(10000)
DeletePed(targ)
targbusy = false
sold = true
sell = false
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)
Wait(10000)
DeletePed(targ)
targbusy = false
sold = true
end,
canInteract = function()
if not targbusy then return true end end,
distance = 2.0
},
{ label = 'Deny Price', icon = "fas fa-eye",
onSelect = function()
PoliceCall(20)
targbusy = true
if not progressbar('Telling This Dumbass To Leave!', 4000, 'argue5') then return end
FreezeEntityPosition(targ, false)
ClearPedTasks(targ)
Wait(10000)
DeletePed(targ)
targbusy = false
sold = true
end,
canInteract = function()
if not targbusy then return true end end,
distance = 2.0
},
}
local optionsqb = {
{ label = 'Sell ' .. bagAmount .. ' Of ' .. GetLabel(item) .. ' For $' .. price .. '!', icon = "fas fa-eye",
local options = {
{ label = 'Sell ' .. amount .. ' Of ' .. GetLabel(item) .. ' For $' .. price .. '!', icon = "fas fa-eye",
action = function()
PoliceCall(20)
targbusy = true
if IsPedInAnyVehicle(PlayerPedId(), true) then
Notify('STRANGER DANGER, I WONT GET IN THE CAR WITH YOU', 'error')
FreezeEntityPosition(targ, false)
ClearPedTasks(targ)
Wait(10000)
DeletePed(targ)
targbusy = false
sold = true
sell = false
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)
Wait(10000)
DeletePed(targ)
targbusy = false
sold = true
sellDrug(item, amount, price, targ)
end,
canInteract = function()
if not targbusy then return true end end,
distance = 2.0
onSelect = function()
sellDrug(item, amount, price, targ)
end,
canInteract = function()
if not targbusy then return true end end,
},
{ label = 'Deny Price', icon = "fas fa-eye",
action = function()
PoliceCall(20)
targbusy = true
if not progressbar('Telling This Dumbass To Leave!', 4000, 'argue5') then return end
FreezeEntityPosition(targ, false)
ClearPedTasks(targ)
Wait(10000)
DeletePed(targ)
targbusy = false
sold = true
deny(targ)
end,
onSelect = function()
deny(targ)
end,
canInteract = function()
if not targbusy then return true end end,
distance = 2.0
},
}
if Config.oxtarget then
exports.ox_target:addLocalEntity(targ, options)
else
exports['qb-target']:AddTargetEntity(targ, { options = optionsqb, distance = 2.0})
end
}
AddMultiModel(targ, options, nil)
repeat
Wait(1000)
until sold
@@ -125,7 +82,7 @@ end
RegisterNetEvent('md-drugs:client:cornerselling', function()
if not GetCops(QBConfig.MinimumDrugSalePolice) then return end
local item, amount = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false)
local item, amount, price = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false)
if item ~= 'nothing' then
if sell then
Notify('Lazy Ass Cant Even Sell Drugs', 'error')