Skip to content

Commit

Permalink
Merge pull request #480 from Cocodrulo/fix/lint-erros
Browse files Browse the repository at this point in the history
refactor(server/consumables): remove unused `Player` variable
  • Loading branch information
GhzGarage authored Jan 6, 2025
2 parents dd53a5c + 73a2c1e commit b0d7d84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
6 changes: 0 additions & 6 deletions server/consumables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -29,23 +27,20 @@ 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)
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)
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)
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions server/logs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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] = {}
Expand Down

0 comments on commit b0d7d84

Please sign in to comment.