Skip to content

Commit

Permalink
fix: txAdmin Heal Everyone functionality (#98)
Browse files Browse the repository at this point in the history
* fix: txAdmin Heal Everyone functionality

* Update main.lua
  • Loading branch information
mafewtm authored Aug 11, 2024
1 parent c0eed4c commit 5a1a83a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 2 additions & 1 deletion client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,13 @@ end

---heals player wounds.
---@param type? 'full'|any heals all wounds if full otherwise heals only major wounds.
lib.callback.register('qbx_medical:client:heal', function(type)
RegisterNetEvent('qbx_medical:client:heal', function(type)
if type == 'full' then
resetAllInjuries()
else
resetMinorInjuries()
end

exports.qbx_core:Notify(locale('success.wounds_healed'), 'success')
end)

Expand Down
9 changes: 3 additions & 6 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,23 @@ end)

---@param player table|number
local function revivePlayer(player)
if type(player) == 'number' then
player = exports.qbx_core:GetPlayer(player)
end
TriggerClientEvent('qbx_medical:client:playerRevived', player.PlayerData.source)
TriggerClientEvent('qbx_medical:client:playerRevived', player --[[@as number]])
end

exports('Revive', revivePlayer)

---removes all ailments, sets to full health, and fills up hunger and thirst.
---@param src Source
local function heal(src)
lib.callback.await('qbx_medical:client:heal', src, 'full')
TriggerClientEvent('qbx_medical:client:heal', src, 'full')
end

exports('Heal', heal)

---Removes any injuries with severity 2 or lower. Stops bleeding if bleed level is less than 3.
---@param src Source
local function healPartially(src)
lib.callback.await('qbx_medical:client:heal', src, 'partial')
TriggerClientEvent('qbx_medical:client:heal', src, 'partial')
end

exports('HealPartially', healPartially)
Expand Down

0 comments on commit 5a1a83a

Please sign in to comment.