Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: txAdmin Heal Everyone functionality #98

Merged
merged 2 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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