Fix Styling (#758)

* style: ensure consistent indentation

* style: add spacing

* style: add newlines

* style: simplify html

* fix: update javascript indent size in contribution guidelines
This commit is contained in:
David Malchin
2022-07-18 23:45:46 +03:00
committed by GitHub
parent 657f55b599
commit 7fab401ed2
13 changed files with 197 additions and 202 deletions
+14 -14
View File
@@ -216,31 +216,31 @@ QBCore.Functions.CreateCallback('QBCore:HasItem', function(source, cb, items, am
local Player = QBCore.Functions.GetPlayer(source)
if not Player then return cb(false) end
local isTable = type(items) == 'table'
local isArray = isTable and table.type(items) == 'array' or false
local totalItems = #items
local count = 0
local isArray = isTable and table.type(items) == 'array' or false
local totalItems = #items
local count = 0
local kvIndex = 2
if isTable and not isArray then
if isTable and not isArray then
totalItems = 0
for _ in pairs(items) do totalItems += 1 end
kvIndex = 1
end
if isTable then
for k, v in pairs(items) do
local itemKV = {k, v}
local item = Player.Functions.GetItemByName(itemKV[kvIndex])
for k, v in pairs(items) do
local itemKV = {k, v}
local item = Player.Functions.GetItemByName(itemKV[kvIndex])
if item and ((amount and item.amount >= amount) or (not amount and not isArray and item.amount >= v) or (not amount and isArray)) then
count += 1
end
end
if count == totalItems then
retval = true
end
else -- Single item as string
local item = Player.Functions.GetItemByName(items)
end
if count == totalItems then
retval = true
end
else -- Single item as string
local item = Player.Functions.GetItemByName(items)
if item and not amount or (item and amount and item.amount >= amount) then
retval = true
end
end
end
cb(retval)
end)