Skip to content

Commit

Permalink
fix: reviving and HasItem error (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
mafewtm authored Dec 29, 2023
1 parent 62034b9 commit 2402f1e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions client/job.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ end)
---Use first aid on nearest player to revive them.
---Intended to be invoked by client or server.
RegisterNetEvent('hospital:client:RevivePlayer', function()
if not exports.qbx_core:HasItem('firstaid') then
local hasFirstAid = exports.ox_inventory:Search('count', 'firstaid') > 0
if not hasFirstAid then
exports.qbx_core:Notify(Lang:t('error.no_firstaid'), 'error')
return
end
Expand Down Expand Up @@ -155,7 +156,8 @@ end)
---Use bandage on nearest player to treat their wounds.
---Intended to be invoked by client or server.
RegisterNetEvent('hospital:client:TreatWounds', function()
if not exports.qbx_core:HasItem('bandage') then
local hasBandage = exports.ox_inventory:Search('count', 'bandage') > 0
if not hasBandage then
exports.qbx_core:Notify(Lang:t('error.no_bandage'), 'error')
return
end
Expand Down
2 changes: 1 addition & 1 deletion server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ RegisterNetEvent('hospital:server:RevivePlayer', function(playerId)
if not patient then return end
player.Functions.RemoveItem('firstaid', 1)
TriggerClientEvent('inventory:client:ItemBox', player.PlayerData.source, exports.ox_inventory:Items()['firstaid'], "remove")
TriggerClientEvent('hospital:client:Revive', patient.PlayerData.source)
TriggerClientEvent('qbx_medical:client:playerRevived', patient.PlayerData.source)
end)

---@param targetId number
Expand Down

0 comments on commit 2402f1e

Please sign in to comment.