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
+156 -110

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",
+8 -10
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)
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 = {
{
+46 -42
View File
@@ -85,39 +85,43 @@ end
print"dude, it literally tells you what you need to set it as in the config"
end
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
return Items[img]['client']['image']
end
elseif GetResourceState('ps-inventory') == 'started' then
return "nui://ps-inventory/html/images/".. QBCore.Shared.Items[img].image
elseif GetResourceState('lj-inventory') == 'started' then
return "nui://lj-inventory/html/images/".. QBCore.Shared.Items[img].image
elseif GetResourceState('qb-inventory') == 'started' then
return "nui://qb-inventory/html/images/".. QBCore.Shared.Items[img].image
elseif GetResourceState('qs-inventory') == 'started' then
return "nui://qs-inventory/html/img/".. QBCore.Shared.Items[img].image
elseif GetResourceState('origen_inventory') == 'started' then
return "nui://origen_inventory/html/img/".. QBCore.Shared.Items[img].image
elseif GetResourceState('core_inventory') == 'started' then
return "nui://core_inventory/html/img/".. QBCore.Shared.Items[img].image
end
end
function GetLabel(label)
if GetResourceState('ox_inventory') == 'started' then
local Items = exports['ox_inventory']:Items()
return Items[label]['label']
else
return QBCore.Shared.Items[label]['label']
end
end
function GetImage(img)
if GetResourceState('ox_inventory') == 'started' then
local Items = exports['ox_inventory']:Items()
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
elseif GetResourceState('lj-inventory') == 'started' then
return "nui://lj-inventory/html/images/".. QBCore.Shared.Items[img].image
elseif GetResourceState('qb-inventory') == 'started' then
return "nui://qb-inventory/html/images/".. QBCore.Shared.Items[img].image
elseif GetResourceState('qs-inventory') == 'started' then
return "nui://qs-inventory/html/img/".. QBCore.Shared.Items[img].image
elseif GetResourceState('origen_inventory') == 'started' then
return "nui://origen_inventory/html/img/".. QBCore.Shared.Items[img].image
elseif GetResourceState('core_inventory') == 'started' then
return "nui://core_inventory/html/img/".. QBCore.Shared.Items[img].image
end
end
function GetLabel(label)
if GetResourceState('ox_inventory') == 'started' then
local Items = exports['ox_inventory']:Items()
return Items[label]['label']
else
return QBCore.Shared.Items[label]['label']
end
end
function ItemCheck(item)
local success
@@ -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},