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: store vehicle, getclosestplayer, banking #109

Merged
merged 3 commits into from
Dec 1, 2023
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
14 changes: 7 additions & 7 deletions client/job.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ end
---Check status of nearest player and show treatment menu.
---Intended to be invoked by client or server.
RegisterNetEvent('hospital:client:CheckStatus', function()
local player, distance = GetClosestPlayer()
if player == -1 or distance > 5.0 then
local player = GetClosestPlayer()
if not player then
exports.qbx_core:Notify(Lang:t('error.no_player'), 'error')
return
end
Expand Down Expand Up @@ -119,8 +119,8 @@ RegisterNetEvent('hospital:client:RevivePlayer', function()
return
end

local player, distance = GetClosestPlayer()
if player == -1 or distance >= 5.0 then
local player = GetClosestPlayer()
if not player then
exports.qbx_core:Notify(Lang:t('error.no_player'), 'error')
return
end
Expand Down Expand Up @@ -160,8 +160,8 @@ RegisterNetEvent('hospital:client:TreatWounds', function()
return
end

local player, distance = GetClosestPlayer()
if player == -1 or distance >= 5.0 then
local player = GetClosestPlayer()
if not player then
exports.qbx_core:Notify(Lang:t('error.no_player'), 'error')
return
end
Expand Down Expand Up @@ -219,7 +219,7 @@ local function checkGarageAction(vehicles, vehiclePlatePrefix, coords)
lib.hideTextUI()
checkVehicle = false
if cache.vehicle then
exports.qbx_core:DeleteVehicle(cache.vehicle)
DeleteEntity(cache.vehicle)
else
showGarageMenu(vehicles, vehiclePlatePrefix, coords)
end
Expand Down
4 changes: 2 additions & 2 deletions client/laststand.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ lib.callback.register('hospital:client:UseFirstAid', function()
return
end

local player, distance = GetClosestPlayer()
if player ~= -1 and distance < 1.5 then
local player = GetClosestPlayer()
if player then
local playerId = GetPlayerServerId(player)
TriggerServerEvent('hospital:server:UseFirstAid', playerId)
end
Expand Down
3 changes: 1 addition & 2 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ CreateThread(function()
end)

function GetClosestPlayer()
local coords = GetEntityCoords(cache.ped)
return exports.qbx_core:GetClosestPlayer(coords)
return lib.getClosestPlayer(GetEntityCoords(cache.ped), 5.0, false)
end

function OnKeyPress(cb)
Expand Down
3 changes: 3 additions & 0 deletions config/server.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
return {
doctorCallCooldown = 1, -- Time in minutes for cooldown between doctors calls
wipeInvOnRespawn = true, -- Enable to disable removing all items from player on respawn
depositSociety = function(society, amount)
exports['Renewed-Banking']:addAccountMoney(society, amount)
end
}
4 changes: 2 additions & 2 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ end
---@param player Player
local function billPlayer(player)
player.Functions.RemoveMoney("bank", sharedConfig.checkInCost, "respawned-at-hospital")
exports.qbx_management:AddMoney("ambulance", sharedConfig.checkInCost)
config.depositSociety("ambulance", sharedConfig.checkInCost)
TriggerClientEvent('hospital:client:SendBillEmail', player.PlayerData.source, sharedConfig.checkInCost)
end

Expand Down Expand Up @@ -86,7 +86,7 @@ lib.callback.register('qbx_ambulancejob:server:isBedTaken', function(_, hospital
end)

lib.callback.register('qbx_ambulancejob:server:getPlayerStatus', function(_, targetSrc)
return exports.qbx_medical:getPlayerStatus(targetSrc)
return exports.qbx_medical:GetPlayerStatus(targetSrc)
end)

local function alertAmbulance(src, text)
Expand Down
Loading