diff --git a/server/consumables.lua b/server/consumables.lua index a099df68..4205cbfa 100644 --- a/server/consumables.lua +++ b/server/consumables.lua @@ -11,7 +11,6 @@ end for k, _ in pairs(Config.Consumables.eat) do QBCore.Functions.CreateUseableItem(k, function(source, item) - local Player = QBCore.Functions.GetPlayer(source) if not exports['qb-inventory']:RemoveItem(source, item.name, 1, item.slot, 'qb-smallresources:consumables:eat') then return end TriggerClientEvent('consumables:client:Eat', source, item.name) end) @@ -20,7 +19,6 @@ end ----------- / Drink for k, _ in pairs(Config.Consumables.drink) do QBCore.Functions.CreateUseableItem(k, function(source, item) - local Player = QBCore.Functions.GetPlayer(source) if not exports['qb-inventory']:RemoveItem(source, item.name, 1, item.slot, 'qb-smallresources:consumables:drink') then return end TriggerClientEvent('consumables:client:Drink', source, item.name) end) @@ -29,7 +27,6 @@ end ----------- / Custom for k, _ in pairs(Config.Consumables.custom) do QBCore.Functions.CreateUseableItem(k, function(source, item) - local Player = QBCore.Functions.GetPlayer(source) if not exports['qb-inventory']:RemoveItem(source, item.name, 1, item.slot, 'qb-smallresources:consumables:custom') then return end TriggerClientEvent('consumables:client:Custom', source, item.name) end) @@ -37,7 +34,6 @@ end local function createItem(name, type) QBCore.Functions.CreateUseableItem(name, function(source, item) - local Player = QBCore.Functions.GetPlayer(source) if not exports['qb-inventory']:RemoveItem(source, item.name, 1, item.slot, 'qb-smallresources:consumables:createItem') then return end TriggerClientEvent('consumables:client:' .. type, source, item.name) end) @@ -45,7 +41,6 @@ end ----------- / Drug QBCore.Functions.CreateUseableItem('joint', function(source, item) - local Player = QBCore.Functions.GetPlayer(source) if not exports['qb-inventory']:RemoveItem(source, item.name, 1, item.slot, 'qb-smallresources:joint') then return end TriggerClientEvent('consumables:client:UseJoint', source) end) @@ -94,7 +89,6 @@ QBCore.Functions.CreateUseableItem('binoculars', function(source) end) QBCore.Functions.CreateUseableItem('parachute', function(source, item) - local Player = QBCore.Functions.GetPlayer(source) if not exports['qb-inventory']:RemoveItem(source, item.name, 1, item.slot, 'qb-smallresources:parachute') then return end TriggerClientEvent('consumables:client:UseParachute', source) end) diff --git a/server/logs.lua b/server/logs.lua index 25e469c3..f0a67b39 100644 --- a/server/logs.lua +++ b/server/logs.lua @@ -57,7 +57,6 @@ local colors = { -- https://www.spycolor.com/ local logQueue = {} RegisterNetEvent('qb-log:server:CreateLog', function(name, title, color, message, tagEveryone, imageUrl) - local postData = {} local tag = tagEveryone or false if Config.Logging == 'discord' then @@ -86,11 +85,12 @@ RegisterNetEvent('qb-log:server:CreateLog', function(name, title, color, message logQueue[name][#logQueue[name] + 1] = { webhook = webHook, data = embedData } if #logQueue[name] >= 10 then + local postData = { username = 'QB Logs', embeds = {} } + if tag then - postData = { username = 'QB Logs', content = '@everyone', embeds = {} } - else - postData = { username = 'QB Logs', embeds = {} } + postData.content = '@everyone' end + for i = 1, #logQueue[name] do postData.embeds[#postData.embeds + 1] = logQueue[name][i].data[1] end PerformHttpRequest(logQueue[name][1].webhook, function() end, 'POST', json.encode(postData), { ['Content-Type'] = 'application/json' }) logQueue[name] = {}