forked from Simnation/Main
ed
This commit is contained in:
parent
1010f8fc79
commit
5f826a44a3
2 changed files with 8 additions and 1 deletions
|
@ -1841,7 +1841,8 @@ Config.Items = {
|
||||||
armor = 0,
|
armor = 0,
|
||||||
alcohol = 0,
|
alcohol = 0,
|
||||||
stamina = 0,
|
stamina = 0,
|
||||||
}
|
},
|
||||||
|
return_item = "empty_bottle" -- This is the item that will be returned after all uses
|
||||||
},
|
},
|
||||||
["junk_energy"] = {
|
["junk_energy"] = {
|
||||||
uses = 1,
|
uses = 1,
|
||||||
|
|
|
@ -50,6 +50,11 @@ lib.callback.register("pickle_consumables:useItem", function(source)
|
||||||
end
|
end
|
||||||
metadata.uses = metadata.uses - 1
|
metadata.uses = metadata.uses - 1
|
||||||
if metadata.uses < 1 then
|
if metadata.uses < 1 then
|
||||||
|
-- Check if we should return an item when fully consumed
|
||||||
|
if cfg.return_item then
|
||||||
|
-- Add the return item to player's inventory
|
||||||
|
Inventory.AddItem(source, cfg.return_item, 1)
|
||||||
|
end
|
||||||
Players[source] = nil
|
Players[source] = nil
|
||||||
end
|
end
|
||||||
if cfg then
|
if cfg then
|
||||||
|
@ -63,6 +68,7 @@ lib.callback.register("pickle_consumables:useItem", function(source)
|
||||||
return true, metadata.uses
|
return true, metadata.uses
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
RegisterNetEvent("pickle_consumables:returnItem", function(destroy)
|
RegisterNetEvent("pickle_consumables:returnItem", function(destroy)
|
||||||
local source = source
|
local source = source
|
||||||
if not Players[source] then return end
|
if not Players[source] then return end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue