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

bugfix: ems heals work and adjust healing #107

Closed
wants to merge 2 commits into from
Closed

bugfix: ems heals work and adjust healing #107

wants to merge 2 commits into from

Conversation

solareon
Copy link
Contributor

Description

Healing a player as ems didn't do anything. This corrects that issue and prevents players from getting stuck in a bed. Items are also now removed when using them. Also adjusted the amounts healed to be more reasonable.

Checklist

  • I have personally loaded this code into an updated Qbox project and checked all of its functionality.
  • My code fits the style guidelines.
  • My PR fits the contribution guidelines.

@solareon solareon changed the title Solareon patch 4 bugfix: ems heals work and adjust healing Nov 28, 2023
TriggerClientEvent('inventory:client:ItemBox', player.PlayerData.source, exports.ox_inventory:Items()['firstaid'], "remove")
TriggerClientEvent('hospital:client:Revive', patient.PlayerData.source)
if not player or not exports.ox_inventory:RemoveItem(src, 'firstaid', 1) then return end
TriggerClientEvent('qbx_medical:client:playerRevived', player.PlayerData.source)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably call an server side export? Not sure that this event is intended to be public

player.Functions.RemoveItem('bandage', 1)
TriggerClientEvent('inventory:client:ItemBox', src, exports.ox_inventory:Items()['bandage'], "remove")
TriggerClientEvent("hospital:client:HealInjuries", patient.PlayerData.source, "full")
lib.callback("qbx_medical:client:heal", patient.PlayerData.source, false, "full")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably call a server side export.

local player = exports.qbx_core:GetPlayer(source)
local patient = exports.qbx_core:GetPlayer(playerId)
local src = source
local player = exports.qbx_core:GetPlayer(playerId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

player seems to only be used to get playerId anyway, so this could be simplified further not to convert to player.

player.Functions.RemoveItem('bandage', 1)
TriggerClientEvent('inventory:client:ItemBox', src, exports.ox_inventory:Items()['bandage'], "remove")
TriggerClientEvent("hospital:client:HealInjuries", patient.PlayerData.source, "full")
lib.callback("qbx_medical:client:heal", patient.PlayerData.source, false, "full")
end)

---@param playerId number
RegisterNetEvent('hospital:server:RevivePlayer', function(playerId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we just delete this event altogether in favor of calling qbx_medical exports directly?

setBedCam()
CreateThread(function()
Wait(5)
if isRevive then
exports.qbx_core:Notify(Lang:t('success.being_helped'), 'success')
Wait(config.aiHealTimer * 1000)
TriggerEvent("hospital:client:Revive")
else
TriggerEvent("qbx_medical:client:playerRevived")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking this should be an export. In general I don't think resource A should trigger events owned by resource B. API should be provided via exports.

@ChatDisabled
Copy link
Member

@solareon update on requested changes

@solareon
Copy link
Contributor Author

@ChatDisabled out on Christmas vacation for a couple weeks. I'll work on these when I get back. If someone else would like to work on them I can port them to the main repo and let others hack on it a bit. Just let me know

@solareon solareon marked this pull request as draft January 19, 2024 10:05
@solareon solareon closed this Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants