forked from Simnation/Main
ed
This commit is contained in:
parent
cb3d888d34
commit
86bbde2668
2 changed files with 4 additions and 15 deletions
|
@ -23,5 +23,6 @@ lua54 'yes'
|
||||||
dependencies {
|
dependencies {
|
||||||
'qb-target',
|
'qb-target',
|
||||||
'qb-core',
|
'qb-core',
|
||||||
'ox_lib'
|
'ox_lib',
|
||||||
|
'tgiann-inventory'
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,20 +7,8 @@ end
|
||||||
|
|
||||||
-- Function to check if player has an item
|
-- Function to check if player has an item
|
||||||
local function HasItem(source, itemName, amount)
|
local function HasItem(source, itemName, amount)
|
||||||
local items = exports["tgiann-inventory"]:GetPlayerItems(source)
|
local itemCount = exports["tgiann-inventory"]:GetItemCount(source, itemName)
|
||||||
if not items then return false end
|
return itemCount >= amount
|
||||||
|
|
||||||
local count = 0
|
|
||||||
for _, item in pairs(items) do
|
|
||||||
if item.name == itemName then
|
|
||||||
count = count + item.count
|
|
||||||
if count >= amount then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Event for client to check if player has an item
|
-- Event for client to check if player has an item
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue