big update. i prob broke something, let me know in discord
This commit is contained in:
1 parent
009b0a4f4a
commit
028c5f771f
42 files changed
+2042
-3056
No files matched your search
+11
-25
@@ -1,21 +1,22 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
local StolenDrugs = {}
|
||||
|
||||
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
|
||||
local type = 0
|
||||
for k in pairs(QBConfig.DrugsPrice) do
|
||||
for k, v in pairs(QBConfig.DrugsPrice) do
|
||||
local item = Player.Functions.GetItemByName(k)
|
||||
if item and type == 0 then
|
||||
type = type + 1
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Allowed To Sell ' .. item.name .. '!' , 'cornerselling')
|
||||
return item.name, item.amount
|
||||
Log(GetName(source) .. ' Allowed To Sell ' .. item.name .. '!' , 'cornerselling')
|
||||
local amount = math.random(1,item.amount)
|
||||
if amount >= 15 then amount = 15 end
|
||||
local price = math.random(QBConfig.DrugsPrice[k]['min'], QBConfig.DrugsPrice[k]['max']) * amount
|
||||
return item.name, amount, price
|
||||
end
|
||||
end
|
||||
if type == 0 then
|
||||
return 'nothing', 0
|
||||
return 'nothing', 0, 0
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -23,9 +24,8 @@ end)
|
||||
RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
if RemoveItem(item, amount) then
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Sold ' .. amount .. ' Of ' .. item .. ' For A Price Of ' .. price .. '!' , 'cornerselling')
|
||||
if RemoveItem(src, item, amount) then
|
||||
Log(GetName(src) .. ' Sold ' .. amount .. ' Of ' .. item .. ' For A Price Of ' .. price .. '!' , 'cornerselling')
|
||||
if QBConfig.MarkedBills then
|
||||
if price >= QBConfig.DrugsPrice[item]['min'] * amount and price <= QBConfig.DrugsPrice[item]['max'] * amount then
|
||||
local info = {
|
||||
@@ -34,27 +34,13 @@ RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price
|
||||
Player.Functions.AddItem('markedbills', 1, false, info )
|
||||
end
|
||||
elseif QBConfig.CustomDirtyMoney then
|
||||
Player.Functions.AddItem(QBConfig.CustomDirtyMoneyitem,price)
|
||||
AddItem(src, QBConfig.CustomDirtyMoneyitem, price)
|
||||
else
|
||||
Player.Functions.AddMoney('cash', price)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('md-drugs:server:robCornerDrugs', function(drugType, amount)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local availableDrugs = getAvailableDrugs(src)
|
||||
|
||||
if not availableDrugs or not Player then return end
|
||||
|
||||
local item = availableDrugs[drugType].item
|
||||
|
||||
Player.Functions.RemoveItem(item, amount)
|
||||
table.insert(StolenDrugs, {item = item, amount = amount})
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "remove", amount)
|
||||
TriggerClientEvent('md-drugs:client:refreshAvailableDrugs', src, getAvailableDrugs(src))
|
||||
end)
|
||||
lib.addCommand('cornersell', {
|
||||
help = 'Sell Things On The Corner',
|
||||
params = {
|
||||
@@ -63,6 +49,6 @@ lib.addCommand('cornersell', {
|
||||
}, function(source, args, raw)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
Log(Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname .. ' Used Command cornersell!' , 'cornerselling')
|
||||
Log(GetName(source) .. ' Used Command cornersell!' , 'cornerselling')
|
||||
TriggerClientEvent('md-drugs:client:cornerselling', src)
|
||||
end)
|
||||
Reference in new issue
Block a user