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:
Mustache Dom authored and GitHub committed 2024-07-11 17:39:58 -07:00
1 parent 5448eabd87
commit b6b4776ab2
16 files changed
+125 -79

No files matched your search

+8 -6
View File
@@ -9,9 +9,10 @@ RegisterNetEvent('coke:respawnCane', function(loc)
--if not HasModelLoaded(hash) then LoadModel(hash) end
if not CocaPlant[loc] then
CocaPlant[loc] = CreateObject(hash, v.location, false, true, true)
SetEntityAsMissionEntity(CocaPlant[loc], true, true)
FreezeEntityPosition(CocaPlant[loc], true)
SetEntityHeading(CocaPlant[loc], v.heading)
-- SetEntityAsMissionEntity(CocaPlant[loc], true, true)
-- FreezeEntityPosition(CocaPlant[loc], true)
-- SetEntityHeading(CocaPlant[loc], v.heading)
Freeze(CocaPlant[loc], true, v.heading)
exports['qb-target']:AddTargetEntity(CocaPlant[loc], {
options = { {
icon = "fas fa-hand",
@@ -38,9 +39,10 @@ RegisterNetEvent("coke:init", function()
if not HasModelLoaded(hash) then LoadModel(hash) end
if not v.taken then
CocaPlant[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true)
SetEntityAsMissionEntity(CocaPlant[k], true, true)
FreezeEntityPosition(CocaPlant[k], true)
SetEntityHeading(CocaPlant[k], v.heading)
-- SetEntityAsMissionEntity(CocaPlant[k], true, true)
-- FreezeEntityPosition(CocaPlant[k], true)
-- SetEntityHeading(CocaPlant[k], v.heading)
Freeze(CocaPlant[k], true, v.heading)
exports['qb-target']:AddTargetEntity(CocaPlant[k], {
options = { {
icon = "fas fa-hand",
+7 -9
View File
@@ -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)
+4 -5
View File
@@ -205,8 +205,9 @@ function InitZones()
end
testdealer = CreatePed(0, Ped,v.coords.x,v.coords.y,v.coords.z-1, 90.0, false, false)
FreezeEntityPosition(testdealer, true)
SetEntityInvincible(testdealer, true)
-- FreezeEntityPosition(testdealer, true)
-- SetEntityInvincible(testdealer, true)
Freeze(testdealer, true, 90)
exports["qb-target"]:AddBoxZone("dealer_"..k, vector3(v.coords.x, v.coords.y, v.coords.z), 1.5, 1.5, {
name = "dealer_"..k,
heading = v.heading,
@@ -310,9 +311,7 @@ RegisterNetEvent('md-drugs:client:setLocation', function(locationData)
end
Buyer = CreatePed(0, Ped,activeDelivery["coords"].x, activeDelivery["coords"].y, activeDelivery["coords"].z-1, 180.0, false, false)
FreezeEntityPosition(Buyer, true)
SetEntityInvincible(Buyer, true)
Freeze(Buyer, true, 180)
exports['qb-target']:AddTargetEntity(Buyer, {
options = {
{
+16 -12
View File
@@ -89,10 +89,14 @@ end
function GetImage(img)
if GetResourceState('ox_inventory') == 'started' then
local Items = exports['ox_inventory']:Items()
if Items[img]['client']['image'] == nil then
return Items[img]
else
if Items[img]['client'] then
if Items[img]['client']['image'] then
return Items[img]['client']['image']
else
return "nui://ox_inventory/web/images/".. img.. '.png'
end
else
return "nui://ox_inventory/web/images/".. img.. '.png'
end
elseif GetResourceState('ps-inventory') == 'started' then
return "nui://ps-inventory/html/images/".. QBCore.Shared.Items[img].image
@@ -197,15 +201,15 @@ end
function GetCops(number)
if number == 0 then return true end
local need = false
local nope = false
QBCore.Functions.TriggerCallback('md-drugs:server:GetCoppers', function(amount)
if amount >= number then need = true else Notify('You Need '.. number - amount .. ' More Cops To Do This', 'error') nope = true end
end)
repeat
Wait(100)
until need or nope
if need then return true end
local amount = lib.callback.await('md-drugs:server:GetCoppers', false)
if amount >= number then return true else Notify('You Need '.. number - amount .. ' More Cops To Do This', 'error') end
end
function Freeze(entity, toggle, head)
SetEntityInvincible(entity, toggle)
SetEntityAsMissionEntity(entity, toggle, toggle)
FreezeEntityPosition(entity, toggle)
SetEntityHeading(entity, head)
SetBlockingOfNonTemporaryEvents(entity, toggle)
end
+11 -8
View File
@@ -16,8 +16,9 @@ local Ped = "g_m_y_famdnf_01"
lib.requestModel("g_m_y_famdnf_01", Config.RequestModelTime)
local labkitlocation = Config.buyheroinlabkit
local heroinkitdealer = CreatePed(0, Ped, labkitlocation.x, labkitlocation.y, labkitlocation.z-1, labkitlocation.w, false, false)
FreezeEntityPosition(heroinkitdealer, true)
SetEntityInvincible(heroinkitdealer, true)
-- FreezeEntityPosition(heroinkitdealer, true)
-- SetEntityInvincible(heroinkitdealer, true)
Freeze(heroinkitdealer, true, labkitlocation.w)
local options = {
{ label = "Buy Heroin Lab Kit", icon = "fas fa-eye", event = "md-drugs:client:buyheroinlabkit", distance = 2.0},
}
@@ -35,9 +36,10 @@ RegisterNetEvent('heroin:respawnCane', function(loc)
--if not HasModelLoaded(hash) then LoadModel(hash) end
if not PoppyPlants[loc] then
PoppyPlants[loc] = CreateObject(hash, v.location, false, true, true)
SetEntityAsMissionEntity(PoppyPlants[loc], true, true)
FreezeEntityPosition(PoppyPlants[loc], true)
SetEntityHeading(PoppyPlants[loc], v.heading)
-- SetEntityAsMissionEntity(PoppyPlants[loc], true, true)
-- FreezeEntityPosition(PoppyPlants[loc], true)
-- SetEntityHeading(PoppyPlants[loc], v.heading)
Freeze(PoppyPlants[loc], true, v.heading)
exports['qb-target']:AddTargetEntity(PoppyPlants[loc], {
options = { {
icon = "fas fa-hand",
@@ -68,9 +70,10 @@ RegisterNetEvent("heroin:init", function()
if not HasModelLoaded(hash) then LoadModel(hash) end
if not v.taken then
PoppyPlants[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true)
SetEntityAsMissionEntity(PoppyPlants[k], true, true)
FreezeEntityPosition(PoppyPlants[k], true)
SetEntityHeading(PoppyPlants[k], v.heading)
-- SetEntityAsMissionEntity(PoppyPlants[k], true, true)
-- FreezeEntityPosition(PoppyPlants[k], true)
-- SetEntityHeading(PoppyPlants[k], v.heading)
Freeze(PoppyPlants[k], true, v.heading)
exports['qb-target']:AddTargetEntity(PoppyPlants[k], {
options = { {
icon = "fas fa-hand",
+3 -2
View File
@@ -4,8 +4,9 @@ CreateThread(function()
local current = "s_m_m_doctor_01"
lib.requestModel(current, Config.RequestModelTime)
local SyrupLocation = CreatePed(0, current,Config.SyrupVendor.x,Config.SyrupVendor.y,Config.SyrupVendor.z-1, Config.SyrupVendor.w, false, false)
FreezeEntityPosition(SyrupLocation, true)
SetEntityInvincible(SyrupLocation, true)
--FreezeEntityPosition(SyrupLocation, true)
-- SetEntityInvincible(SyrupLocation, true)
Freeze(SyrupLocation, true, Config.SyrupVendor.w)
local options = {
{ type = "client", label = "Get Task", icon = "fas fa-eye", event = "md-drugs:client:getsyruplocationtobuy", distance = 2.0},
}
+3 -2
View File
@@ -16,8 +16,9 @@ CreateThread(function()
local Ped = "g_m_y_famdnf_01"
lib.requestModel(Ped, Config.RequestModelTime)
local tabdealer = CreatePed(0, Ped,Config.buylsdlabkit.x,Config.buylsdlabkit.y,Config.buylsdlabkit.z-1, Config.buylsdlabkit.w, false, false)
FreezeEntityPosition(tabdealer, true)
SetEntityInvincible(tabdealer, true)
-- FreezeEntityPosition(tabdealer, true)
-- SetEntityInvincible(tabdealer, true)
Freeze(tabdealer, true, Config.buylsdlabkit.w)
local options = {
{ type = "client", label = "Buy LSD Lab Kit", icon = "fas fa-eye", event = "md-drugs:client:buylabkit", distance = 2.0}
}
+8 -6
View File
@@ -14,9 +14,10 @@ RegisterNetEvent('Mescaline:respawnCane', function(loc)
local hash = GetHashKey(v.model)
if not Mescaline[loc] then
Mescaline[loc] = CreateObject(hash, v.location, false, true, true)
SetEntityAsMissionEntity(Mescaline[loc], true, true)
FreezeEntityPosition(Mescaline[loc], true)
SetEntityHeading(Mescaline[loc], v.heading)
--SetEntityAsMissionEntity(Mescaline[loc], true, true)
--FreezeEntityPosition(Mescaline[loc], true)
--SetEntityHeading(Mescaline[loc], v.heading)
Freeze(Mescaline[loc], true, v.heading)
exports['qb-target']:AddTargetEntity(Mescaline[loc], {
options = {
{icon = "fas fa-hand",label = "pick Cactus",action = function() if not progressbar(Lang.mescaline.pick, 4000, 'uncuff') then return end TriggerServerEvent("Mescaline:pickupCane", loc)end}
@@ -41,9 +42,10 @@ RegisterNetEvent("Mescaline:init", function()
if not HasModelLoaded(hash) then LoadModel(hash) end
if not v.taken then
Mescaline[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true)
SetEntityAsMissionEntity(Mescaline[k], true, true)
FreezeEntityPosition(Mescaline[k], true)
SetEntityHeading(Mescaline[k], v.heading)
--SetEntityAsMissionEntity(Mescaline[k], true, true)
--FreezeEntityPosition(Mescaline[k], true)
--SetEntityHeading(Mescaline[k], v.heading)
Freeze(Mescaline[k], true, v.heading)
exports['qb-target']:AddTargetEntity(Mescaline[k], {
options = { { icon = "fas fa-hand", label = "Pick Mescaline", action = function() if not progressbar(Lang.mescaline.pick, 4000, 'uncuff') then return end TriggerServerEvent("Mescaline:pickupCane", k) end}
},
+4 -3
View File
@@ -197,9 +197,10 @@ else
lib.requestModel(current, Config.RequestModelTime)
local CurrentLocation = Config.MethHeistStart
local methdealer = CreatePed(0, current, CurrentLocation.x, CurrentLocation.y, CurrentLocation.z - 1, false, false)
FreezeEntityPosition(methdealer, true)
SetEntityHeading(methdealer, 220.0)
SetEntityInvincible(methdealer, true)
--FreezeEntityPosition(methdealer, true)
--SetEntityHeading(methdealer, 220.0)
--SetEntityInvincible(methdealer, true)
Freeze(methdealer, true, 220.0)
exports['qb-target']:AddTargetEntity(methdealer, {
options = {
{
+4 -3
View File
@@ -55,9 +55,10 @@ RegisterNetEvent("md-drugs:client:getoxylocationroute", function()
local current = "g_m_y_famdnf_01"
lib.requestModel(current, Config.RequestModelTime)
local oxybuyer = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false)
SetEntityHeading(oxybuyer, 180)
FreezeEntityPosition(oxybuyer, true)
SetEntityInvincible(oxybuyer, true)
--SetEntityHeading(oxybuyer, 180)
--FreezeEntityPosition(oxybuyer, true)
--SetEntityInvincible(oxybuyer, true)
Freeze(oxybuyer, true, CurrentLocation.w)
repeat
Wait(1000)
until #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x,CurrentLocation.y,CurrentLocation.z)) < 5.0
+8 -6
View File
@@ -16,9 +16,10 @@ RegisterNetEvent('shrooms:respawnCane', function(loc)
--if not HasModelLoaded(hash) then LoadModel(hash) end
if not shrooms[loc] then
shrooms[loc] = CreateObject(hash, v.location, false, true, true)
SetEntityAsMissionEntity(shrooms[loc], true, true)
FreezeEntityPosition(shrooms[loc], true)
SetEntityHeading(shrooms[loc], v.heading)
-- SetEntityAsMissionEntity(shrooms[loc], true, true)
-- FreezeEntityPosition(shrooms[loc], true)
-- SetEntityHeading(shrooms[loc], v.heading)
Freeze(shrooms[loc], true, v.heading)
exports['qb-target']:AddTargetEntity(shrooms[loc], {
options = { { icon = "fas fa-hand", label = "pick shrooms", action = function() if not progressbar(Lang.Shrooms.pick, 4000, 'uncuff') then return end TriggerServerEvent("shrooms:pickupCane", loc) end }
},
@@ -63,9 +64,10 @@ end)
if not HasModelLoaded(hash) then LoadModel(hash) end
if not v.taken then
shrooms[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true)
SetEntityAsMissionEntity(shrooms[k], true, true)
FreezeEntityPosition(shrooms[k], true)
SetEntityHeading(shrooms[k], v.heading)
--SetEntityAsMissionEntity(shrooms[k], true, true)
--FreezeEntityPosition(shrooms[k], true)
--SetEntityHeading(shrooms[k], v.heading)
Freeze(shrooms[k], true, v.heading)
exports['qb-target']:AddTargetEntity(shrooms[k], {
options = { { icon = "fas fa-hand", label = "Pick shrooms", action = function() if not progressbar(Lang.Shrooms.pick, 4000, 'uncuff') then return end TriggerServerEvent("shrooms:pickupCane", k) end }
},
+3 -2
View File
@@ -5,8 +5,9 @@ local current = "g_m_y_famdnf_01"
lib.requestModel(current, Config.RequestModelTime)
local CurrentLocation = Config.Travellingmerchant[math.random(#Config.Travellingmerchant)]
local travellingmerchant = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false)
FreezeEntityPosition(travellingmerchant, true)
SetEntityInvincible(travellingmerchant, true)
--FreezeEntityPosition(travellingmerchant, true)
--SetEntityInvincible(travellingmerchant, true)
Freeze(travellingmerchant, true, CurrentLocation.w)
if Config.oxtarget then
local options = {
{ label = "Travelling Merchant", icon = "fas fa-eye", onSelect = function() lib.showContext('travellingmerchant') end},
+11 -8
View File
@@ -16,9 +16,10 @@ RegisterNetEvent('weed:respawnCane', function(loc)
if not HasModelLoaded(hash) then LoadModel(hash) end
if not WeedPlant[loc] then
WeedPlant[loc] = CreateObject(hash, v.location.x, v.location.y, v.location.z-3.5, false, true, true)
SetEntityAsMissionEntity(WeedPlant[loc], true, true)
FreezeEntityPosition(WeedPlant[loc], true)
SetEntityHeading(WeedPlant[loc], v.heading)
--SetEntityAsMissionEntity(WeedPlant[loc], true, true)
--FreezeEntityPosition(WeedPlant[loc], true)
--SetEntityHeading(WeedPlant[loc], v.heading)
Freeze(WeedPlant[loc],true, v.heading)
exports['qb-target']:AddTargetEntity(WeedPlant[loc], {
options = {
{
@@ -51,9 +52,10 @@ RegisterNetEvent("weed:init", function()
if not HasModelLoaded(hash) then LoadModel(hash) end
if not v.taken then
WeedPlant[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z-3.5, false, true, true)
SetEntityAsMissionEntity(WeedPlant[k], true, true)
FreezeEntityPosition(WeedPlant[k], true)
SetEntityHeading(WeedPlant[k], v.heading)
--SetEntityAsMissionEntity(WeedPlant[k], true, true)
--FreezeEntityPosition(WeedPlant[k], true)
--SetEntityHeading(WeedPlant[k], v.heading)
Freeze(WeedPlant[k],true, v.heading)
exports['qb-target']:AddTargetEntity(WeedPlant[k], {
options = {
{
@@ -390,8 +392,9 @@ local current = "u_m_m_jesus_01"
lib.requestModel(current, Config.RequestModelTime)
local CurrentLocation = Config.WeedSaleman
local WeedGuy = CreatePed(0,current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false)
FreezeEntityPosition(WeedGuy, true)
SetEntityInvincible(WeedGuy, true)
--FreezeEntityPosition(WeedGuy, true)
--SetEntityInvincible(WeedGuy, true)
Freeze(WeedGuy, true, CurrentLocation.w)
exports['qb-target']:AddTargetEntity(WeedGuy, {
options = {
{label = "Weed Shop",icon = "fas fa-eye",action = function() lib.showContext('WeedShop')end},
+3 -4
View File
@@ -3,7 +3,7 @@ local StolenDrugs = {}
QBCore.Functions.CreateCallback('md-drugs:server:cornerselling:getAvailableDrugs', function(source, cb)
lib.callback.register('md-drugs:server:cornerselling:getAvailableDrugs', function(source, cb)
local AvailableDrugs = {}
local Player = QBCore.Functions.GetPlayer(source)
if not Player then return nil end
@@ -12,12 +12,11 @@ QBCore.Functions.CreateCallback('md-drugs:server:cornerselling:getAvailableDrugs
local item = Player.Functions.GetItemByName(k)
if item and type == 0 then
type = type + 1
cb(item.name, item.amount)
return item.name, item.amount
end
end
if type == 0 then
print(type)
cb('nothing', 0)
return 'nothing', 0
end
end)
+31 -2
View File
@@ -13,6 +13,18 @@ function Notifys(text, type)
end
end
function checkTable(player, table)
local need = 0
local have = 0
for k, v in pairs (table) do
need = need + 1
if Itemcheck(player, k, v, 'true') then have = have + 1 end
end
if need == have then
return true
else
end
end
function Itemcheck(Player, item, amount, notify)
local itemchecks = Player.Functions.GetItemByName(item)
local yes
@@ -53,7 +65,18 @@ function AddItem(item, amount)
end
end
QBCore.Functions.CreateCallback('md-drugs:server:GetCoppers', function(source, cb, args)
--QBCore.Functions.CreateCallback('md-drugs:server:GetCoppers', function(source, cb, args)
-- local amount = 0
-- local players = QBCore.Functions.GetQBPlayers()
-- for k, v in pairs(players) do
-- if v.PlayerData.job.type == 'leo' and v.PlayerData.job.onduty then
-- amount = amount + 1
-- end
-- end
-- cb(amount)
--end)
lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args)
local amount = 0
local players = QBCore.Functions.GetQBPlayers()
for k, v in pairs(players) do
@@ -61,9 +84,15 @@ QBCore.Functions.CreateCallback('md-drugs:server:GetCoppers', function(source, c
amount = amount + 1
end
end
cb(amount)
return amount
end)
lib.addCommand('cornersell', {
help = 'Start/Stop Cornerselling',
restricted = 'group.admin'
}, function(source, args, raw)
TriggerClientEvent('md-drugs:client:cornerselling',source)
end)
CreateThread(function()
if not GetResourceState('ox_lib'):find("start") then
+1 -1
View File
@@ -179,7 +179,7 @@ Config.Items = { --- this is the store for the travelling merchant
[4] = {name = "mdp2p", price = 25, amount = 50, },
[5] = {name = "lysergic_acid", price = 25, amount = 50, },
[6] = {name = "diethylamide", price = 25, amount = 50, },
[7] = {name = "empty_weed_bag", price = 2, amount = 1000, },
[7] = {name = "lockpick", price = 2, amount = 1000, },
[8] = {name = "emptyvial", price = 2, amount = 1000, },
[9] = {name = "needle", price = 2, amount = 1000, },
[10] = {name = "cokeburner", price = 25, amount = 50, },