Files
md-drugs/client/weed.lua
T

148 lines
6.0 KiB
Lua
Raw Normal View History

2024-10-28 14:11:49 -07:00
local exploded, drying = false, false
2024-01-13 22:23:17 -08:00
local function hasJob()
if Config.Joblock then
2024-12-12 15:26:48 -08:00
if getJobName() == Config.weedjob then
2024-10-28 14:11:49 -07:00
return true else return false end
else
return true end
end
2024-01-13 22:23:17 -08:00
CreateThread(function()
2025-07-01 03:09:46 -07:00
local config = ps.callback('md-drugs:server:getLocs', false)
2024-11-12 01:04:42 -08:00
AddBoxZoneMulti('weeddry', config.WeedDry, {
name = 'dryweed',
icon = "fas fa-sign-in-alt",
2024-10-23 17:44:46 -07:00
label = Lang.targets.weed.dry,
distance = 1,
action = function()
if not ItemCheck('wetcannabis') then return end
if drying then
2025-07-17 02:06:17 -05:00
ps.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)
2025-07-17 02:06:17 -05:00
ps.notify(Lang.Weed.wait, "success")
Wait(math.random(1000,5000))
2025-07-17 02:06:17 -05:00
ps.notify(Lang.Weed.take, "success")
AddSingleModel(weedplant, {
2024-11-25 01:21:53 -08:00
icon = "fa-solid fa-cannabis",
2024-10-23 17:44:46 -07:00
label = Lang.targets.weed.dpick,
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
})
2024-01-13 22:23:17 -08:00
2024-11-25 01:21:53 -08:00
AddBoxZoneSingle('teleinweedout', config.singleSpot.weedTeleout, { name = 'teleout', icon = "fa-solid fa-door-closed", label = Lang.targets.coke.exit, distance = 2.0, action = function() SetEntityCoords(PlayerPedId(),config.singleSpot.weedTelein) end,
canInteract = function() if hasJob() then return true end end
})
2024-11-25 01:21:53 -08:00
AddBoxZoneSingle('teleinweedin', config.singleSpot.weedTelein, { name = 'teleout', icon = "fa-solid fa-door-open", label = Lang.targets.coke.enter, distance = 2.0, action = function() SetEntityCoords(PlayerPedId(),config.singleSpot.weedTeleout) end,
canInteract = function() if hasJob() then return true end end
})
2024-11-25 01:21:53 -08:00
AddBoxZoneSingle('MakeButterCrafting', config.singleSpot.MakeButter, {label = Lang.targets.weed.butt, action = function() lib.showContext('ButterCraft') end, icon = "fa-solid fa-cookie",
canInteract = function() if hasJob() then return true end end
})
2024-01-13 22:23:17 -08:00
2024-11-25 19:57:26 -08:00
AddBoxZoneSingle('makeoil',config.singleSpot.MakeOil, {
name = 'Oil',
2024-11-25 01:21:53 -08:00
icon = "fa-solid fa-oil-can",
2024-10-23 17:44:46 -07:00
label = Lang.targets.weed.oil,
action = function()
if not ItemCheckMulti({'butane', 'grindedweed'}) then return end
2024-10-23 17:44:46 -07:00
if not minigame() then
2024-10-24 20:00:27 -07:00
local loc = GetEntityCoords(PlayerPedId())
2024-11-25 12:27:43 -08:00
AddExplosion(loc.x, loc.y, loc.z, 49, 10, true, false, true)
exploded = true
2025-07-17 02:06:17 -05:00
ps.notify(Lang.Weed.stovehot, "error")
Wait(1000 * 30)
exploded = false
return end
2025-07-17 02:06:17 -05:00
if not ps.progressbar(Lang.Weed.shat, 4000, 'uncuff') then return end
TriggerServerEvent("md-drugs:server:makeoil")
end,
canInteract = function()
if hasJob() and exploded == false then return true end
end,
})
local stove = CreateObject("prop_cooker_03",config.singleSpot.MakeButter.x, config.singleSpot.MakeButter.y, config.singleSpot.MakeButter.z-1, true, false)
SetEntityHeading(stove, 270.00)
FreezeEntityPosition(stove, true)
local stove2 = CreateObject("prop_cooker_03",config.singleSpot.MakeOil.x,config.singleSpot.MakeOil.y, config.singleSpot.MakeOil.z-1, true, false)
SetEntityHeading(stove2, 90.00)
FreezeEntityPosition(stove2, true)
2024-01-13 22:23:17 -08:00
end)
CreateThread(function()
BikerWeedFarm = exports['bob74_ipl']:GetBikerWeedFarmObject()
BikerWeedFarm.Style.Set(BikerWeedFarm.Style.upgrade)
BikerWeedFarm.Security.Set(BikerWeedFarm.Security.upgrade)
BikerWeedFarm.Details.Enable(BikerWeedFarm.Details.chairs, true)
BikerWeedFarm.Details.Enable({BikerWeedFarm.Details.production, BikerWeedFarm.Details.chairs, BikerWeedFarm.Details.drying}, true)
BikerWeedFarm.Plant1.Clear(false) BikerWeedFarm.Plant2.Clear(false) BikerWeedFarm.Plant3.Clear(false)
BikerWeedFarm.Plant4.Clear(false) BikerWeedFarm.Plant5.Clear(false) BikerWeedFarm.Plant6.Clear(false)
BikerWeedFarm.Plant7.Clear(false) BikerWeedFarm.Plant8.Clear(false) BikerWeedFarm.Plant9.Clear(false)
2024-01-13 22:23:17 -08:00
RefreshInterior(BikerWeedFarm.interiorId)
end)
RegisterNetEvent("md-drugs:client:dodabs", function()
2025-07-17 02:06:17 -05:00
if not ps.progressbar('Doing Dabs', 4000, 'bong2') then AlienEffect() return end
2024-11-25 19:57:26 -08:00
AlienEffect()
2024-01-13 22:23:17 -08:00
end)
local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tableName)
local options = {}
2025-07-01 03:09:46 -07:00
local items = ps.callback('md-drugs:server:GetRecipe', false,'weed',tableName)
for k, v in pairs(items) do
local label = {}
local item = ''
for m, d in pairs(v.take) do table.insert(label, GetLabel(m) .. ' X ' .. d) end
for m, d in pairs(v.give) do item = m end
options[#options + 1] = {
icon = GetImage(item),
description = table.concat(label, ", "),
title = GetLabel(item),
event = "md-drugs:client:MakeWeedItems",
args = {
item = item,
recipe = 'weed',
num = k,
label = eventLabelPrefix .. GetLabel(item),
table = tableName
}
}
end
sorter(options, 'title')
2024-11-25 19:57:26 -08:00
lib.registerContext({ id = contextId, title = contextTitle, options = options})
end
CreateThread(function()
2025-07-17 02:06:17 -05:00
--createBluntOptions('ButterCraft', "Edible Cooking", 'Cooking A ', 'edibles')
--createBluntOptions('mddrugsblunts', "Roll Blunts", 'Rolling A ', 'blunts')
--createBluntOptions('mddrugsbluntwraps', "Dipping Syrup", 'Dipping Syrup To Make ', 'bluntwrap')
end)
RegisterNetEvent("md-drugs:client:MakeWeedItems", function(data)
if not minigame() then return end
2025-07-17 02:06:17 -05:00
if not ps.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)