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
|
@ -99,12 +99,17 @@ function AddItem(source, item, amount, metadata)
|
||||||
exports['ox_inventory']:AddItem(source, item, amount, metadata)
|
exports['ox_inventory']:AddItem(source, item, amount, metadata)
|
||||||
elseif GetResourceState('qs-inventory') == 'started' then
|
elseif GetResourceState('qs-inventory') == 'started' then
|
||||||
exports['qs-inventory']:AddItem(source, item, amount, false, metadata)
|
exports['qs-inventory']:AddItem(source, item, amount, false, metadata)
|
||||||
elseif GetResourceState('tgiann-inventory') == 'started' then
|
elseif GetResourceState('tgiann-inventory') == 'started' then
|
||||||
-- Check if the item is a weapon and ensure 'serie' exists in metadata
|
-- Ensure metadata is a table
|
||||||
if string.match(item, "WEAPON_") and not metadata.serie then
|
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))
|
metadata.serie = tostring(math.random(100000, 999999))
|
||||||
end
|
end
|
||||||
exports["tgiann-inventory"]:AddItem(source, item, amount, nil, metadata, nil)
|
end
|
||||||
|
exports["tgiann-inventory"]:AddItem(source, item, amount, nil, metadata, nil)
|
||||||
elseif GetResourceState('origen_inventory') == 'started' then
|
elseif GetResourceState('origen_inventory') == 'started' then
|
||||||
exports['origen_inventory']:addItem(source, item, amount, metadata, false)
|
exports['origen_inventory']:addItem(source, item, amount, metadata, false)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue