forked from Simnation/Main
Update sv_function.lua
This commit is contained in:
parent
d546bef0c5
commit
bf9a3be387
1 changed files with 9 additions and 4 deletions
|
@ -100,10 +100,15 @@ function AddItem(source, item, amount, metadata)
|
|||
elseif GetResourceState('qs-inventory') == 'started' then
|
||||
exports['qs-inventory']:AddItem(source, item, amount, false, metadata)
|
||||
elseif GetResourceState('tgiann-inventory') == 'started' then
|
||||
-- Check if the item is a weapon and ensure 'serie' exists in metadata
|
||||
if string.match(item, "WEAPON_") and not metadata.serie then
|
||||
-- Ensure metadata is a table
|
||||
metadata = metadata or {}
|
||||
|
||||
-- Check if the item is a weapon and ensure 'serie' exists in metadata as a string
|
||||
if string.match(item:upper(), "WEAPON_") then
|
||||
if not metadata.serie or type(metadata.serie) ~= "string" then
|
||||
metadata.serie = tostring(math.random(100000, 999999))
|
||||
end
|
||||
end
|
||||
exports["tgiann-inventory"]:AddItem(source, item, amount, nil, metadata, nil)
|
||||
elseif GetResourceState('origen_inventory') == 'started' then
|
||||
exports['origen_inventory']:addItem(source, item, amount, metadata, false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue