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

+3 -4
View File
@@ -3,7 +3,7 @@ local StolenDrugs = {}
QBCore.Functions.CreateCallback('md-drugs:server:cornerselling:getAvailableDrugs', function(source, cb)
lib.callback.register('md-drugs:server:cornerselling:getAvailableDrugs', function(source, cb)
local AvailableDrugs = {}
local Player = QBCore.Functions.GetPlayer(source)
if not Player then return nil end
@@ -12,12 +12,11 @@ QBCore.Functions.CreateCallback('md-drugs:server:cornerselling:getAvailableDrugs
local item = Player.Functions.GetItemByName(k)
if item and type == 0 then
type = type + 1
cb(item.name, item.amount)
return item.name, item.amount
end
end
if type == 0 then
print(type)
cb('nothing', 0)
return 'nothing', 0
end
end)
+31 -2
View File
@@ -13,6 +13,18 @@ function Notifys(text, type)
end
end
function checkTable(player, table)
local need = 0
local have = 0
for k, v in pairs (table) do
need = need + 1
if Itemcheck(player, k, v, 'true') then have = have + 1 end
end
if need == have then
return true
else
end
end
function Itemcheck(Player, item, amount, notify)
local itemchecks = Player.Functions.GetItemByName(item)
local yes
@@ -53,7 +65,18 @@ function AddItem(item, amount)
end
end
QBCore.Functions.CreateCallback('md-drugs:server:GetCoppers', function(source, cb, args)
--QBCore.Functions.CreateCallback('md-drugs:server:GetCoppers', function(source, cb, args)
-- local amount = 0
-- local players = QBCore.Functions.GetQBPlayers()
-- for k, v in pairs(players) do
-- if v.PlayerData.job.type == 'leo' and v.PlayerData.job.onduty then
-- amount = amount + 1
-- end
-- end
-- cb(amount)
--end)
lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args)
local amount = 0
local players = QBCore.Functions.GetQBPlayers()
for k, v in pairs(players) do
@@ -61,9 +84,15 @@ QBCore.Functions.CreateCallback('md-drugs:server:GetCoppers', function(source, c
amount = amount + 1
end
end
cb(amount)
return amount
end)
lib.addCommand('cornersell', {
help = 'Start/Stop Cornerselling',
restricted = 'group.admin'
}, function(source, args, raw)
TriggerClientEvent('md-drugs:client:cornerselling',source)
end)
CreateThread(function()
if not GetResourceState('ox_lib'):find("start") then