3 Commits

Author SHA1 Message Date
Jim Shield
ce137d9089 Version Bump
`2.0.08` - `2.0.09`
2025-10-12 00:10:28 +01:00
Jim Shield
d7a8a20491 Make GenerateRandomValues() return 0
Its possible if no health, thirst or stress was set, it may sent back an empty table, which would then break the finish consume function in the server
2025-10-10 01:57:01 +01:00
Jim Shield
38d0b04e71 Fix pack and return items not being given 2025-10-06 12:56:14 +01:00
4 changed files with 13 additions and 16 deletions

View File

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

View File

@@ -120,10 +120,8 @@ RegisterNetEvent(getScript()..":server:finishConsume", function(needTypes)
removeItem(isConsuming[src].item, 1, src)
if isConsuming[src].rewardItem then
debugPrint("^5Debug^7: ^2Giving player ^3"..src.." ^2reward items^7")
for i = 1, #isConsuming[src].rewardItem do
local item = isConsuming[src].rewardItem[i]
addItem(item.item, item.amount, nil, src)
end
local item = isConsuming[src].rewardItem
addItem(item.item, item.amount, nil, src)
end
if isConsuming[src].returnItem then
debugPrint("^5Debug^7: ^2Giving player ^3"..src.." ^2return item^7")
@@ -133,11 +131,9 @@ RegisterNetEvent(getScript()..":server:finishConsume", function(needTypes)
end
end
if isConsuming[src].packItem then
for i = 1, #isConsuming[src].packItem do
debugPrint("^5Debug^7: ^2Giving player ^3"..src.." ^2Pack items^7")
local item = isConsuming[src].packItem[i]
addItem(item.item, item.amount, nil, src)
end
local item = isConsuming[src].packItem
addItem(item.item, item.amount, nil, src)
end
-- Needs

View File

@@ -15,6 +15,7 @@ function GenerateRandomValues(data)
transData[k] = v
end
end
if transData.hunger > 0 then
transData.hunger = transData.hunger > 100 and 100 or transData.hunger
end
@@ -26,12 +27,13 @@ function GenerateRandomValues(data)
if transData.stress > 0 then
transData.stress = transData.stress > 100 and 100 or transData.stress
end
return transData["time"],
transData["heal"],
transData["armor"],
{
hunger = transData["hunger"],
thirst = transData["thirst"],
stress = transData["stress"]
hunger = transData["hunger"] or 0,
thirst = transData["thirst"] or 0,
stress = transData["stress"] or 0
}
end

View File

@@ -1,7 +1,6 @@
2.0.08
2.0.09
- Fix issues with stress calculations
- Separates "drug control" from canOD boolean
- Adds support for jim_bridge built-in synchronized alcohol/drug effects
- Fix possible issue with nil needTypes tables being sent
- Fix packitems and return items not giving any items
https://github.com/jimathy/jim-consumables/releases/latest