Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Commit aa7d7ad

Browse files
committed
fix(client): check if player is dead during each state of item use
Also reduce wait after using item to set invBusy to false.
1 parent 29a69fc commit aa7d7ad

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

client.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ exports('openInventory', OpenInventory)
135135

136136
local function useItem(data, cb)
137137
if invOpen and data.close then TriggerEvent('ox_inventory:closeInventory') end
138-
if not invBusy and not Interface.ProgressActive and not IsPedRagdoll(cache.ped) and not IsPedFalling(cache.ped) then
138+
if not invBusy and not PlayerData.dead and not Interface.ProgressActive and not IsPedRagdoll(cache.ped) and not IsPedFalling(cache.ped) then
139139
if currentWeapon and currentWeapon?.timer > 100 then return end
140140

141141
invBusy = true
@@ -164,7 +164,7 @@ local function useItem(data, cb)
164164
prop = data.prop,
165165
propTwo = data.propTwo
166166
}, function(cancel)
167-
p:resolve(cancel)
167+
p:resolve(PlayerData.dead or cancel)
168168
end)
169169
end
170170

@@ -186,7 +186,7 @@ local function useItem(data, cb)
186186
end
187187

188188
if cb then cb(result) end
189-
Wait(500)
189+
Wait(200)
190190
plyState.invBusy = false
191191
return
192192
end
@@ -200,7 +200,7 @@ AddEventHandler('ox_inventory:item', useItem)
200200
exports('useItem', useItem)
201201

202202
local function useSlot(slot)
203-
if PlayerData.loaded and not invBusy and not Interface.ProgressActive then
203+
if PlayerData.loaded and not PlayerData.dead and not invBusy and not Interface.ProgressActive then
204204
local item = PlayerData.inventory[slot]
205205
if not item then return end
206206
local data = item and Items[item.name]

fxmanifest.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ game 'gta5'
77
--[[ Resource Information ]]--
88
name 'ox_inventory'
99
author 'Overextended'
10-
version '2.5.6'
10+
version '2.6.0'
1111
repository 'https://github.com/overextended/ox_inventory'
1212
description 'Slot-based inventory with metadata'
1313

0 commit comments

Comments
 (0)