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

+210 -303
View File
@@ -10,32 +10,31 @@ function LoadModel(hash)
end
end
local function hasJob()
if Config.Joblock then
if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
return true else return false end
else
return true end
end
RegisterNetEvent('weed:respawnCane', function(loc)
local v = GlobalState.WeedPlant[loc]
local hash = GetHashKey(v.model)
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)
Freeze(WeedPlant[loc],true, v.heading)
exports['qb-target']:AddTargetEntity(WeedPlant[loc], {
options = {
{
icon = "fas fa-hand",
label = "Pick Weed",
action = function()
if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end
TriggerServerEvent("weed:pickupCane", loc)
end,
canInteract = function()
if Config.Joblock then
if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
return true end
else
return true end end,
}
},
distance = 2.5
})
Freeze(WeedPlant[loc],true, v.heading)
AddSingleModel(WeedPlant[loc],
{
icon = "fas fa-hand",
label = "Pick Weed",
action = function()
if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end
TriggerServerEvent("weed:pickupCane", loc)
end
}, loc)
end
end)
@@ -50,26 +49,16 @@ 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)
Freeze(WeedPlant[k],true, v.heading)
exports['qb-target']:AddTargetEntity(WeedPlant[k], {
options = {
{
icon = "fas fa-hand",
label = "Pick Weed",
action = function()
if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end
TriggerServerEvent("weed:pickupCane", k)
end,
canInteract = function()
if Config.Joblock then
if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
return true end
else
return true end end,
}
},
distance = 2.5
})
Freeze(WeedPlant[k],true, v.heading)
AddSingleModel(WeedPlant[k],
{
icon = "fas fa-hand",
label = "Pick Weed",
action = function()
if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end
TriggerServerEvent("weed:pickupCane", k)
end
}, k)
end
end
end)
@@ -98,234 +87,74 @@ AddEventHandler('onResourceStop', function(resourceName)
end)
CreateThread(function()
AddBoxZoneMulti('weeddry', Config.WeedDry, {
name = 'dryweed',
icon = "fas fa-sign-in-alt",
label = "Dry Weed",
distance = 1,
action = function()
if not ItemCheck('wetcannabis') then return end
if drying then
Notify(Lang.Weed.busy, "error")
else
local loc = GetEntityCoords(PlayerPedId())
local weedplant = CreateObject("bkr_prop_weed_drying_01a", loc.x, loc.y+.2, loc.z, true, false)
drying = true
FreezeEntityPosition(weedplant, true)
Notify("Wait A little Bit To Dry", "success")
Wait(math.random(1000,5000))
Notify("Take Down The Weed", "success")
AddSingleModel(weedplant, {
icon = "fas fa-sign-in-alt",
label = "Pick Up Weed",
action = function()
DeleteEntity(weedplant)
drying = false
TriggerServerEvent('md-drugs:server:dryoutweed')
end,
canInteract = function()
if hasJob() then return true end end
}, nil)
end
end,
canInteract = function()
if hasJob() then return true end end
})
AddBoxZoneSingle('teleinweedout', Config.Teleout, { name = 'teleout', icon = "fas fa-sign-in-alt", label = "Enter Building", distance = 2.0, action = function() SetEntityCoords(PlayerPedId(),Config.Telein) end,
canInteract = function() if hasJob() then return true end end
})
AddBoxZoneSingle('teleinweedin', Config.Telein, { name = 'teleout', icon = "fas fa-sign-in-alt", label = "Exit Building", distance = 2.0, action = function() SetEntityCoords(PlayerPedId(),Config.Teleout) end,
canInteract = function() if hasJob() then return true end end
})
AddBoxZoneSingle('MakeButterCrafting', Config.MakeButter, {label = 'Open Butter Menu', action = function() lib.showContext('ButterCraft') end, icon = "fas fa-sign-in-alt",
canInteract = function() if hasJob() then return true end end
})
for k, v in pairs (Config.WeedDry) do
exports['qb-target']:AddBoxZone("weeddry"..k,v,1.5, 1.75, {name = "weeddry"..k,heading = 11.0,debugPoly = false,minZ = v.z-2,maxZ = v.z+2,}, {
options = {
{
name = 'dryweed',
icon = "fas fa-sign-in-alt",
label = "Dry Weed",
distance = 1,
item = "wetcannabis",
action = function()
if drying then
Notify(Lang.Weed.busy, "error")
else
local loc = GetEntityCoords(PlayerPedId())
local weedplant = CreateObject("bkr_prop_weed_drying_01a", loc.x, loc.y+.2, loc.z, true, false)
drying = true
FreezeEntityPosition(weedplant, true)
Notify("Wait A little Bit To Dry", "success")
Wait(math.random(1000,5000))
Notify("Take Down The Weed", "success")
local options = {
{
icon = "fas fa-sign-in-alt",
label = "Pick Up Weed",
action = function()
DeleteEntity(weedplant)
drying = false
TriggerServerEvent('md-drugs:server:dryoutweed')
end,
canInteract = function()
if Config.Joblock then
if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
return true end
else
return true end end,
}
}
local optionsox = {
{
icon = "fas fa-sign-in-alt",
label = "Pick Up Weed",
onSelect = function()
DeleteEntity(weedplant)
drying = false
TriggerServerEvent('md-drugs:server:dryoutweed')
end,
canInteract = function()
if Config.Joblock then
if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
return true end
else
return true end end,
}
}
if Config.oxtarget then
exports.ox_target:addLocalEntity(weedplant, optionsox )
else
exports['qb-target']:AddTargetEntity(weedplant, {options = options})
end
end
end,
canInteract = function()
if Config.Joblock then
if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
if drying == false then
return true end end
else
return true end end,
},
},
})
end
exports['qb-target']:AddBoxZone("teleinweed",Config.Telein,1.5, 1.75, {name = "teleinweed",heading = 11.0,debugPoly = false,minZ = Config.Telein.z-2,maxZ = Config.Telein.z+2,}, {
options = {
{ name = 'teleout', icon = "fas fa-sign-in-alt", label = "Enter Building", distance = 2.0,
action = function()
SetEntityCoords(PlayerPedId(),Config.Teleout)
end,
canInteract = function()
if Config.Joblock then
if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
return true end
else
return true end end,
},
},
})
exports['qb-target']:AddBoxZone("teleinweedout",Config.Teleout,1.5, 1.75, { name = "teleinweedout",heading = 11.0,debugPoly = false,minZ = Config.Teleout.z-2,maxZ = Config.Teleout.z+2,}, {
options = {
{ name = 'teleout', icon = "fas fa-sign-in-alt", label = "Exit Building", distance = 2.0,
action = function()
SetEntityCoords(PlayerPedId(),Config.Telein)
end,
canInteract = function()
if Config.Joblock then
if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
return true end
else
return true end end,
},
},
})
exports['qb-target']:AddBoxZone("MakeButter",Config.MakeButter,1.5, 1.75, {name = "MakeButter",heading = 11.0,debugPoly = false,minZ = Config.MakeButter.z-2,maxZ = Config.MakeButter.z+2,}, {
options = {
{
name = 'butter',
icon = "fas fa-sign-in-alt",
label = "Make Butter",
action = function()
if not ItemCheck('mdbutter') and not ItemCheck('grindedweed') then return end
if not minigame(2, 8) then return end
if not progressbar(Lang.Weed.canna, 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:makebutter")
end,
canInteract = function()
if Config.Joblock then
if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
return true end
else
return true end end,
},
{
name = 'makebrownies',
icon = "fas fa-sign-in-alt",
label = "Make Brownies",
item = "cannabutter",
action = function()
if not ItemCheck('cannabutter') and not ItemCheck('flour') and not ItemCheck('chocolate') then return end
if not minigame(2, 8) then return end
if not progressbar(Lang.Weed.brown, 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:makebrownies")
end,
canInteract = function()
if Config.Joblock then
if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
return true end
else
return true end end,
},
{
name = 'makecookies',
icon = "fas fa-sign-in-alt",
label = "Make Cookies",
item = "cannabutter",
action = function()
if not ItemCheck('cannabutter') and not ItemCheck('flour') then return end
if not minigame(2, 8) then return end
if not progressbar(Lang.Weed.cook, 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:makecookies")
end,
canInteract = function()
if Config.Joblock then
if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
return true end
else
return true end end,
},
{
name = 'makechocolate',
icon = "fas fa-sign-in-alt",
label = "Make Chocolate",
item = "cannabutter",
action = function()
if not ItemCheck('cannabutter') and not ItemCheck('chocolate') then return end
if not minigame(2, 8) then return end
if not progressbar(Lang.Weed.choc, 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:makechocolate")
end,
canInteract = function()
if Config.Joblock then
if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
return true end
else
return true end end,
},
{
name = 'makemuffin',
icon = "fas fa-sign-in-alt",
label = "Make Muffin",
item = "cannabutter",
action = function()
if not ItemCheck('cannabutter') and not ItemCheck('flour') then return end
if not minigame(2, 8) then return end
if not progressbar(Lang.Weed.muff, 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:makemuffin")
end,
canInteract = function()
if Config.Joblock then
if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then
return true end
else
return true end end,
},
},
})
exports['qb-target']:AddBoxZone("makeoil",Config.MakeOil,1.5, 1.75, {name = "makeoil",heading = 11.0,debugPoly = false,minZ = Config.MakeOil.z-2,maxZ = Config.MakeOil.z+2,}, {
options = {
{
name = 'Oil',
icon = "fas fa-sign-in-alt",
label = "Make Oil",
action = function()
if not ItemCheck('butane') and not ItemCheck('grindedweed') then return end
if not minigame(2, 8) then
local explosion = math.random(1,100)
local loc = GetEntityCoords(PlayerPedId())
if explosion <= 99 then
AddExplosion(loc.x, loc.y, loc.z, 49, 10, true, false, true, true)
exploded = true
Notify(Lang.Weed.stovehot, "error")
Wait(1000 * 30)
exploded = nil
end
return end
if not progressbar(Lang.Weed.shat, 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:makeoil")
end,
canInteract = function()
if exploded == nil then return true end
end,
},
},
})
AddBoxZoneSingle('makeoil',Config.MakeOil, {
name = 'Oil',
icon = "fas fa-sign-in-alt",
label = "Make Oil",
action = function()
if not ItemCheckMulti({'butane', 'grindedweed'}) then return end
if not minigame(2, 8) then
local explosion = math.random(1,100)
local loc = GetEntityCoords(PlayerPedId())
if explosion <= 99 then
AddExplosion(loc.x, loc.y, loc.z, 49, 10, true, false, true, true)
exploded = true
Notify(Lang.Weed.stovehot, "error")
Wait(1000 * 30)
exploded = nil
end
return end
if not progressbar(Lang.Weed.shat, 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:makeoil")
end,
canInteract = function()
if hasJob() and exploded == nil then return true end
end,
} )
end)
CreateThread(function()
@@ -352,29 +181,14 @@ CreateThread(function()
FreezeEntityPosition(stove2, true)
end)
RegisterNetEvent('md-drugs:client:bluntwraps', function(args)
lib.registerContext({
id = 'bluntroll',
title = 'Blunt Types',
menu = 'bluntroll',
options = {
{ title = 'Roll Blunt', description = 'Roll A Regular Blunt', icon = 'check', serverEvent = 'md-drugs:server:rollblunt'},
{ title = 'Dip Blunt Wrap In Lean', description = 'Roll A Lean Blunt', icon = 'check', serverEvent = 'md-drugs:server:rollleanblunt'},
{ title = 'Dip Blunt Wrap In Dextro', description = 'Roll A Dextro Blunt', icon = 'check', serverEvent = 'md-drugs:server:rolldextroblunt'},
{ title = 'Roll A Chewy Blunt', description = 'Roll A Chewy Blunt', icon = 'check', serverEvent = 'md-drugs:server:rollchewyblunt'},
},
})
lib.showContext('bluntroll')
end)
RegisterNetEvent("md-drugs:client:rollanim", function()
if not progressbar(Lang.Weed.roll, 4000, 'uncuff') then return end
end)
RegisterNetEvent("md-drugs:client:grind", function()
if not progressbar("grinding", 4000, 'uncuff') then return end
end)
RegisterNetEvent("md-drugs:client:dodabs", function()
if not progressbar('Doing Dabs', 4000, 'bong2') then return end
@@ -387,27 +201,120 @@ 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)
Freeze(WeedGuy, true, CurrentLocation.w)
exports['qb-target']:AddTargetEntity(WeedGuy, {
options = {
{label = "Weed Shop",icon = "fas fa-eye",action = function() lib.showContext('WeedShop')end},
}
})
for k, v in pairs (Config.Weed.items) do
WeedShop[#WeedShop + 1] = {
icon = GetImage(v.name),
title = GetLabel(v.name),
description = '$'.. v.price,
event = "md-drugs:client:travellingmerchantox",
args = {
item = v.name,
cost = v.price,
amount = v.amount,
table = Config.Weed.items,
num = k,
local WeedGuy = CreatePed(0,current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.h, false, false)
Freeze(WeedGuy, true, CurrentLocation.h)
AddSingleModel(WeedGuy, {label = "Weed Shop",icon = "fas fa-eye",action = function() lib.showContext('WeedShop')end}, nil)
for k, v in pairs (Config.Weed.items) do
WeedShop[#WeedShop + 1] = {
icon = GetImage(v.name),
title = GetLabel(v.name),
description = '$'.. v.price,
event = "md-drugs:client:travellingmerchantox",
args = {
item = v.name,
cost = v.price,
amount = v.amount,
table = Config.Weed.items,
num = k,
}
}
}
lib.registerContext({id = 'WeedShop',title = "Weed Shop", options = WeedShop})
lib.registerContext({id = 'WeedShop',title = "Weed Shop", options = WeedShop})
end
end)
CreateThread(function()
local items = lib.callback.await('md-drugs:server:GetRecipe', false,'weed', 'edibles')
local items2 = lib.callback.await('md-drugs:server:GetRecipe', false,'weed', 'blunts')
local items3 = lib.callback.await('md-drugs:server:GetRecipe', false,'weed', 'bluntwrap')
local craft = {}
local blunt = {}
local bluntwrap = {}
local label = {}
for k, v in pairs (items) do
label = {}
local item = ''
for m, d in pairs (items[k].take) do
table.insert(label, GetLabel(m) .. ' X ' .. d)
end
for m,d in pairs (items[k].give) do
item = m
end
craft[#craft + 1] = {
icon = GetImage(item),
description = table.concat(label, ", "),
title = GetLabel(item),
event = "md-drugs:client:MakeWeedItems",
args = {
item = item,
recipe = 'weed',
num = k,
label = 'Cooking Up ' .. GetLabel(item),
table = 'edibles'
}
}
lib.registerContext({id = 'ButterCraft',title = "Edible Cooking", options = craft})
end
for k, v in pairs (items2) do
label = {}
local item = ''
for m, d in pairs (items2[k].take) do
table.insert(label, GetLabel(m) .. ' X ' .. d)
end
for m, d in pairs (items2[k].give) do
item = m
end
blunt[#blunt + 1] = {
icon = GetImage(item),
description = table.concat(label, ", "),
title = GetLabel(item),
event = "md-drugs:client:MakeWeedItems",
args = {
item = item,
recipe = 'weed',
num = k,
label = 'Rolling A ' .. GetLabel(item),
table = 'blunts'
}
}
lib.registerContext({id = 'mddrugsblunts',title = "Roll Blunts", options = blunt})
end
for k, v in pairs (items3) do
label = {}
local item = ''
for m, d in pairs (items3[k].take) do
table.insert(label, GetLabel(m) .. ' X ' .. d)
end
for m,d in pairs (items3[k].give) do
item = m
end
bluntwrap[#bluntwrap + 1] = {
icon = GetImage(item),
description = table.concat(label, ", "),
title = GetLabel(item),
event = "md-drugs:client:MakeWeedItems",
args = {
item = item,
recipe = 'weed',
num = k,
label = 'Dipping Syrup To Make ' .. GetLabel(item),
table = 'bluntwrap'
}
}
lib.registerContext({id = 'mddrugsbluntwraps',title = "Dip Blunt Wrap", options = bluntwrap})
end
end)
RegisterNetEvent("md-drugs:client:MakeWeedItems", function(data)
if not minigame() then return end
if not progressbar('Making ' .. data.item, 4000, 'uncuff') then return end
TriggerServerEvent('md-drugs:server:MakeWeedItems', data)
end)
RegisterNetEvent('md-drugs:client:makeBluntWrap', function(data)
lib.showContext('mddrugsbluntwraps')
end)
RegisterNetEvent('md-drugs:client:rollBlunt', function(data)
lib.showContext('mddrugsblunts')
end)