added CUI function for createuseableitem. will add support for other frameworks in the future
This commit is contained in:
1 parent
3043ecd924
commit
b56e585691
16 files changed
+42
-47
No files matched your search
@@ -5,6 +5,14 @@ local minigametype = Config.minigametype
|
||||
local notifytype = Config.Notify
|
||||
local dispatch = Config.Dispatch
|
||||
|
||||
function getJobType()
|
||||
return QBCore.Functions.GetPlayerData().job.type
|
||||
end
|
||||
|
||||
function getJobName()
|
||||
return QBCore.Functions.GetPlayerData().job.name
|
||||
end
|
||||
|
||||
function progressbar(text, time, anim)
|
||||
TriggerEvent('animations:client:EmoteCommandStart', {anim})
|
||||
if progressbartype == 'oxbar' then
|
||||
@@ -674,10 +682,3 @@ RegisterCommand('DrugRep', function()
|
||||
lib.showContext('DrugRep')
|
||||
end, false)
|
||||
|
||||
function getJobType()
|
||||
return QBCore.Functions.GetPlayerData().job.type
|
||||
end
|
||||
|
||||
function getJobName()
|
||||
return QBCore.Functions.GetPlayerData().job.name
|
||||
end
|
||||
@@ -9,11 +9,13 @@ client_scripts {
|
||||
}
|
||||
|
||||
server_scripts {
|
||||
'server/functions.lua',
|
||||
'server/**.lua',
|
||||
'@oxmysql/lib/MySQL.lua',
|
||||
}
|
||||
|
||||
shared_scripts {
|
||||
'shared/config.lua',
|
||||
'@ox_lib/init.lua',
|
||||
'shared/**.lua',
|
||||
}
|
||||
|
||||
+2
-2
@@ -125,14 +125,14 @@ end)
|
||||
|
||||
local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3}
|
||||
for k, v in pairs (cokecut) do
|
||||
QBCore.Functions.CreateUseableItem(k, function(source, item)
|
||||
CUI(k, function(source, item)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
if Player.Functions.GetItemByName(item.name) then
|
||||
if not Itemcheck(src, 'bakingsoda', 1) then return end
|
||||
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting It Further')
|
||||
if not check then return end
|
||||
if RemoveItem(src, k, 1) then
|
||||
if RemoveItem(src, k, 1) and RemoveItem(src, k, 1) then
|
||||
AddItem(src, 'loosecoke', v)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
for k, v in pairs(Consumables.Items) do
|
||||
QBCore.Functions.CreateUseableItem(k, function(source, item)
|
||||
CUI(k, function(source, item)
|
||||
if not Itemcheck(source, k, 1) then return end
|
||||
local time = v.time or Consumables.defaulttime
|
||||
local effect = v.effect or 0
|
||||
|
||||
+2
-2
@@ -47,14 +47,14 @@ end)
|
||||
|
||||
local cokecut = {crackrockstagetwo = 2, crackrockstagethree = 3}
|
||||
for k, v in pairs (cokecut) do
|
||||
QBCore.Functions.CreateUseableItem(k, function(source, item)
|
||||
CUI(k, function(source, item)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
if Player.Functions.GetItemByName(item.name) then
|
||||
if not Itemcheck(src, 'bakingsoda', 1) then return end
|
||||
local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting Crack Rock Further')
|
||||
if not check then return end
|
||||
if RemoveItem(src, k, 1) then
|
||||
if RemoveItem(src, k, 1) and RemoveItem(src, 'bakingsoda', 1) then
|
||||
AddItem(src, 'crackrock', v)
|
||||
end
|
||||
end
|
||||
|
||||
+5
-11
@@ -1,6 +1,6 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
local notify = Config.Notify -- qb or ox
|
||||
|
||||
local inventory = Config.Inventory -- qb or ox
|
||||
------------------------------------------ logging stuff
|
||||
local logs = false
|
||||
local logapi = GetConvar("fivemerrLogs", "")
|
||||
@@ -56,16 +56,6 @@ else
|
||||
invname = 'inventory'
|
||||
end
|
||||
end)
|
||||
|
||||
local inventory = ''
|
||||
|
||||
CreateThread(function()
|
||||
if GetResourceState('ox_inventory') == 'started' then
|
||||
inventory = 'ox'
|
||||
else
|
||||
inventory = 'qb'
|
||||
end
|
||||
end)
|
||||
------------------------------------ Player Stuff functions
|
||||
function getPlayer(source)
|
||||
local src = source
|
||||
@@ -126,6 +116,10 @@ function GetLabels(item)
|
||||
end
|
||||
end
|
||||
|
||||
function CUI(item, useFunction)
|
||||
QBCore.Functions.CreateUseableItem(item, useFunction)
|
||||
end
|
||||
|
||||
function Itemcheck(source, item, amount)
|
||||
if inventory == 'qb' then
|
||||
local Player = getPlayer(source)
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ RegisterServerEvent('md-drugs:server:getheroinlabkitback', function()
|
||||
end)
|
||||
|
||||
|
||||
QBCore.Functions.CreateUseableItem('heroinlabkit', function(source, item)
|
||||
CUI('heroinlabkit', function(source, item)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
if not Itemcheck(source, 'heroinlabkit', 1) then return end
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ RegisterServerEvent('md-drugs:server:givelean', function()
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateUseableItem('leancup', function(source, item)
|
||||
CUI('leancup', function(source, item)
|
||||
if Itemcheck(source, 'leancup', 1) then
|
||||
TriggerClientEvent('md-drugs:client:leancraft', source)
|
||||
end
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ RegisterServerEvent('md-drugs:server:getdiethylamide', function(num)
|
||||
end)
|
||||
|
||||
|
||||
QBCore.Functions.CreateUseableItem('lsdlabkit', function(source, item)
|
||||
CUI('lsdlabkit', function(source, item)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
local placed, loc = lib.callback.await('md-drugs:client:setlsdlabkit', src)
|
||||
@@ -195,7 +195,7 @@ local sheets = {
|
||||
}
|
||||
|
||||
for k, v in pairs (sheets) do
|
||||
QBCore.Functions.CreateUseableItem(v.item, function(source)
|
||||
CUI(v.item, function(source)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
local math = math.random(1,10)
|
||||
|
||||
@@ -54,7 +54,7 @@ RegisterNetEvent("md-drugs:server:drymescaline", function()
|
||||
if not GetRecipe(src, 'mescaline', 'dry', 'dried') then return end
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateUseableItem("driedmescaline", function(source, item)
|
||||
CUI("driedmescaline", function(source, item)
|
||||
local src = source
|
||||
if RemoveItem(src, "driedmescaline", 1) then
|
||||
TriggerClientEvent("md-drugs:client:takemescaline", src)
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ local function GetJob(source)
|
||||
end
|
||||
end
|
||||
|
||||
QBCore.Functions.CreateUseableItem('prescription_pad', function(source, item)
|
||||
CUI('prescription_pad', function(source, item)
|
||||
local src = source
|
||||
local near = {}
|
||||
if GetJob(src) then
|
||||
@@ -38,7 +38,7 @@ end)
|
||||
|
||||
local pharmabottle = {'vicodinbottle', 'adderalbottle','morphinebottle','xanaxbottle'}
|
||||
for m, d in pairs (pharmabottle) do
|
||||
QBCore.Functions.CreateUseableItem(d, function(source, item)
|
||||
CUI(d, function(source, item)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
local check = lib.callback.await("md-drugs:client:unbottle", src)
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ RegisterNetEvent("shrooms:pickupCane", function(loc)
|
||||
end
|
||||
end)
|
||||
|
||||
QBCore.Functions.CreateUseableItem('shrooms', function(source, item)
|
||||
CUI('shrooms', function(source, item)
|
||||
local src = source
|
||||
if TriggerClientEvent('md-drugs:client:takeshrooms', src, item.name) then
|
||||
RemoveItem(src, 'shrooms', 1)
|
||||
|
||||
+11
-13
@@ -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,7 +103,8 @@ 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)
|
||||
|
||||
CUI("dabrig", function(source, item)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
|
||||
@@ -117,21 +112,24 @@ 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)
|
||||
|
||||
QBCore.Functions.CreateUseableItem("weedgrinder", function(source, item)
|
||||
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
|
||||
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')
|
||||
|
||||
@@ -16,7 +16,7 @@ local Price = {
|
||||
}
|
||||
|
||||
for k, v in pairs (burners) do
|
||||
QBCore.Functions.CreateUseableItem(k, function(source, item)
|
||||
CUI(k, function(source, item)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
if getCops() < Config.PoliceCount then return Notifys(src, Lang.Wholesale.na, 'error') end
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ local presses = {
|
||||
{item = 'quadpress', data = 'quad'},
|
||||
}
|
||||
for k, v in pairs (presses) do
|
||||
QBCore.Functions.CreateUseableItem(v.item, function(source, item)
|
||||
CUI(v.item, function(source, item)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
local check, loc = lib.callback.await('md-drugs:client:setpress', src, v.data)
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ Config.TierSystem = true -- allows for three tiers of certain drugs ( coke, hero
|
||||
Config.StupidassNewQbItemName = true -- true if you have updated your items.lua from base qb after november 2023 because changing item names this far in a framework is 3 IQ points total
|
||||
Config.RequestModelTime = 30000 -- if you need more time than this, uhhhh wow
|
||||
Config.FancyCokeAnims = true -- if you want multi location this needs to be false
|
||||
|
||||
Config.Inventory = 'qb' -- qb or ox, other if you dont use ox just mark as qb
|
||||
Config.Joblock = false -- if you want weed to be a job
|
||||
Config.weedjob = "" -- what the job name is
|
||||
Config.Badtrip = 20 -- number means % chance to spawn a clone that chases and attacks while on mescaline
|
||||
|
||||
Reference in new issue
Block a user