added CUI function for createuseableitem. will add support for other frameworks in the future

This commit is contained in:
Mustache Dom committed 2024-12-12 17:26:08 -08:00
1 parent 3043ecd924
commit b56e585691
16 files changed
+66 -71

No files matched your search

+22 -24
View File
@@ -79,19 +79,13 @@ end)
local bluntwrap = {'mdreddextro','mdlean'}
for k, v in pairs (bluntwrap) do
QBCore.Functions.CreateUseableItem(v, function(source, item)
local src = source
TriggerClientEvent('md-drugs:client:makeBluntWrap', src)
end)
CUI(v, function(source, item) TriggerClientEvent('md-drugs:client:makeBluntWrap', source) end)
end
local bluntwraps = {'leanbluntwrap', 'dextrobluntwrap', 'bluntwrap'}
for k, v in pairs (bluntwraps) do
QBCore.Functions.CreateUseableItem(v, function(source, item)
local src = source
TriggerClientEvent('md-drugs:client:rollBlunt', source)
end)
CUI(v, function(source, item) TriggerClientEvent('md-drugs:client:rollBlunt', source) end)
end
@@ -109,29 +103,33 @@ RegisterServerEvent('md-drugs:server:makeoil', function(data)
if not GetRecipe(src, 'weed', 'oil', 'shatter') then return end
end)
QBCore.Functions.CreateUseableItem("dabrig", function(source, item)
local src = source
local Player = getPlayer(src)
if Player.Functions.GetItemByName("butanetorch") then
if RemoveItem(src, "shatter", 1) then
TriggerClientEvent("md-drugs:client:dodabs", src)
CUI("dabrig", function(source, item)
local src = source
local Player = getPlayer(src)
if Player.Functions.GetItemByName("butanetorch") then
if RemoveItem(src, "shatter", 1) then
TriggerClientEvent("md-drugs:client:dodabs", src)
end
else
Notifys(src, 'You Need A Butane Torch', 'error')
end
end
end)
QBCore.Functions.CreateUseableItem("weedgrinder", function(source, item)
local src = source
CUI("weedgrinder", function(source, item)
local src = source
local Player = getPlayer(src)
local has = Player.Functions.GetItemByName("drycannabis")
if not has then Notifys(src, 'You Need Dried Cannabis', 'error') return end
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Grinding Weed')
if not check then return end
if RemoveItem(src, "drycannabis",1 ) then
AddItem(src, "grindedweed", 1)
else
Notifys(src,'You Need Dried Weed', 'error')
end
if RemoveItem(src, "drycannabis",1 ) then
AddItem(src, "grindedweed", 1)
end
end)
QBCore.Functions.CreateUseableItem("mdwoods", function(source, item)
CUI("mdwoods", function(source, item)
local src = source
local Player = getPlayer(src)
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Breaking Blunt Open')
@@ -140,4 +138,4 @@ QBCore.Functions.CreateUseableItem("mdwoods", function(source, item)
AddItem(src, "bluntwrap", 5)
AddItem(src, "tobacco", 5)
end
end)
end)