mirror of
https://github.com/jimathy/jim-consumables.git
synced 2026-08-16 22:16:02 +01:00
Compare commits
3 Commits
94023857ff
...
62db9f6900
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62db9f6900 | ||
|
|
6317dee667 | ||
|
|
15bb54c206 |
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user