Hello i wanted to ask if someone has an idea how i can make it so if i drink water that i get an empty bottle from it which then has the function to be refilled i use ox_inventory and ive already tryed adding this code in esx_optionalneeds but that didnt worked out:
ESX.RegisterUsableItem('water', function(source)
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.removeInventoryItem('water', 1)
TriggerClientEvent('esx_status:add', source, 'thirst', 350000)
TriggerClientEvent('esx_optionalneeds:onDrink', source)
Citizen.Wait(0)
xPlayer.addInventoryItem('empty_bottle', 1)
end)
this is the item which is inside my inventory:
['water'] = {
label = 'Wasser',
weight = 50,
stack = true,
close = true,
client = {
status = { thirst = 350000 },
anim = { dict = 'mp_player_intdrink', clip = 'loop_bottle' },
prop = { model = 'prop_ld_flow_bottle', pos = vec3(0, 0, 0), rot = vec3(5.0, 5.0, -180.5) },
usetime = 7500,
},
},
['empty_bottle'] = {
label = 'Leere Flasche',
weight = 3,
stack = true,
close = true,
},