feat: Notify config progressbar config & canrun while consume in config

This commit is contained in:
Atikur Rahaman Santo
2022-08-26 06:10:20 +06:00
committed by GitHub
parent a6f6492d5b
commit a0c83c0e1f
4 changed files with 52 additions and 47 deletions

View File

@@ -6,7 +6,6 @@ for k, v in pairs(Config.Consumables) do
if not Config.Emotes[v.emote] then print("Emote check - '"..k.."' requested emote '"..v.emote.."' - not found in config.lua") end
end
RegisterNetEvent('jim-consumables:server:toggleItem', function(give, item, amount)
local src = source
if give == 0 or give == false then
@@ -18,4 +17,18 @@ RegisterNetEvent('jim-consumables:server:toggleItem', function(give, item, amoun
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], "add", amount or 1)
end
end
end)
RegisterNetEvent('jim-consumables:server:addThirst', function(amount)
local Player = QBCore.Functions.GetPlayer(source)
if not Player then return end
Player.Functions.SetMetaData('thirst', amount)
TriggerClientEvent('hud:client:UpdateNeeds', source, Player.PlayerData.metadata.hunger, amount)
end)
RegisterNetEvent('jim-consumables:server:addHunger', function(amount)
local Player = QBCore.Functions.GetPlayer(source)
if not Player then return end
Player.Functions.SetMetaData('hunger', amount)
TriggerClientEvent('hud:client:UpdateNeeds', source, amount, Player.PlayerData.metadata.thirst)
end)