Merge pull request #175 from Tastyfish/hunger

Configurable hunger and thirst rate.
This commit is contained in:
Kakarot
2021-09-08 23:43:10 -05:00
committed by GitHub
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -11,6 +11,8 @@ QBConfig.Money.PayCheckTimeOut = 10 -- The time in minutes that it will give the
QBConfig.Player = {}
QBConfig.Player.MaxWeight = 120000 -- Max weight a player can carry (currently 120kg, written in grams)
QBConfig.Player.MaxInvSlots = 41 -- Max inventory slots for a player
QBConfig.Player.HungerRate = 4.2 -- Rate at which hunger goes down.
QBConfig.Player.ThirstRate = 3.8 -- Rate at which thirst goes down.
QBConfig.Player.Bloodtypes = {
"A+",
"A-",
+2 -2
View File
@@ -93,8 +93,8 @@ AddEventHandler('QBCore:UpdatePlayer', function(data)
local Player = QBCore.Functions.GetPlayer(src)
if Player ~= nil then
Player.PlayerData.position = data.position
local newHunger = Player.PlayerData.metadata["hunger"] - 4.2
local newThirst = Player.PlayerData.metadata["thirst"] - 3.8
local newHunger = Player.PlayerData.metadata["hunger"] - QBCore.Config.Player.HungerRate
local newThirst = Player.PlayerData.metadata["thirst"] - QBCore.Config.Player.ThirstRate
if newHunger <= 0 then newHunger = 0 end
if newThirst <= 0 then newThirst = 0 end
Player.Functions.SetMetaData("thirst", newThirst)