mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-02 03:08:52 +00:00
Feat(xPlayer): Add xPlayer.hasItem()
This commit is contained in:
@@ -568,6 +568,21 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
return false
|
||||
end
|
||||
|
||||
function self.hasItem(item, metadata)
|
||||
if Inventory then
|
||||
return Inventory.GetItem(self.source, name, metadata)
|
||||
end
|
||||
|
||||
for k,v in ipairs(self.inventory) do
|
||||
if (v.name == name) and (v.count >= 1) then
|
||||
return v, v.count
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
function self.getWeapon(weaponName)
|
||||
if Inventory then return end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user