3 Commits

Author SHA1 Message Date
Jim Shield
62db9f6900 Version Bump
`2.0.06` - `2.0.07`
2025-10-01 21:44:20 +01:00
Jim Shield
6317dee667 Stop double calculation of hunger and thirst
Missed this, it's doing the player stats + new stats and then in jim_bridge doing this again and doubling it all up
2025-10-01 21:43:14 +01:00
Jim Shield
15bb54c206 Add support for jim_bridge setStress function
Allows multiframework stress events
2025-10-01 01:20:33 +01:00
4 changed files with 15 additions and 23 deletions

View File

@@ -294,38 +294,24 @@ RegisterNetEvent(getScript()..':Consume', function(itemName)
if not cancelled then
hideText()
local needTypes = { }
local needTypes = { }
if needStats then
--jsonPrint(needStats)
if needStats.hunger > 0 then
if Core and Core.Functions then
needTypes.hunger = (Core.Functions.GetPlayerData().metadata["hunger"] or 0) + needStats.hunger
needTypes.hunger = needTypes.hunger > 100 and 100 or needTypes.hunger
elseif ESX and ESX.GetPlayerData then
needTypes.hunger = (needStats.hunger / 100) * 1000000
needTypes.hunger = needTypes.hunger > 1000000 and 1000000 or needTypes.hunger
end
needTypes.hunger = needTypes.hunger > 100 and 100 or needTypes.hunger
end
if needStats.thirst > 0 then
if Core and Core.Functions then
needTypes.thirst = (Core.Functions.GetPlayerData().metadata["thirst"] or 0) + needStats.thirst
needTypes.thirst = needTypes.thirst > 100 and 100 or needTypes.thirst
elseif ESX and ESX.GetPlayerData then
needTypes.thirst = (needStats.thirst / 100) * 1000000
needTypes.thirst = needTypes.thirst > 1000000 and 1000000 or needTypes.thirst
end
needTypes.thirst = needTypes.thirst > 100 and 100 or needTypes.thirst
end
end
TriggerServerEvent(getScript()..":server:finishConsume", needTypes)
if stress and stress ~= 0 then
debugPrint("^5Debug^7: ^3Consume^7: ^2Relieving ^6"..stress.." ^2stress^7.")
TriggerServerEvent('hud:server:RelieveStress', stress)
needTypes.stress = stress
end
if heal and heal ~= 0 then
debugPrint("^5Debug^7: ^3Consume^7: ^2Healing player by^7: ^6"..heal)

View File

@@ -1,6 +1,6 @@
name "Jim-Consumables"
author "Jimathy"
version "2.0.06"
version "2.0.07"
description "Consumables Script"
fx_version "cerulean"
game "gta5"

View File

@@ -142,12 +142,17 @@ RegisterNetEvent(getScript()..":server:finishConsume", function(needTypes)
-- Needs
if needTypes.thirst then
debugPrint("^5Debug^7: ^2Thrist^7: [^6"..(needTypes.thirst or 0).."^7]")
setThirst(src, needTypes.thirst)
end
if needTypes.hunger then
debugPrint("^5Debug^7: ^2Hunger^7: [^6"..(needTypes.hunger or 0).."^7]")
setHunger(src, needTypes.hunger)
end
debugPrint("^5Debug^7: ^2Hunger^7: [^6"..(needTypes.hunger or 0).."^7] ^2Thrist^7: [^6"..(needTypes.thirst or 0).."^7]" )
if needTypes.stress then
debugPrint("^5Debug^7: ^2Stress^7: [^6"..(needTypes.stress or 0).."^7]")
setStress(src, needTypes.stress)
end
isConsuming[src] = nil
else
return

View File

@@ -1,5 +1,6 @@
2.0.06
2.0.07
- Increase Secuirty to prevent potential exploits
- Add support for multi-framework stress events (fixes ESX stress)
- Fix double calculation of hunger and thirst
https://github.com/jimathy/jim-consumables
https://github.com/jimathy/jim-consumables/releases/latest