From 26b4e53a178f0be16d00b095fcd0b5fb95258ac4 Mon Sep 17 00:00:00 2001 From: solareon <769465+solareon@users.noreply.github.com> Date: Tue, 28 Nov 2023 22:01:39 +0000 Subject: [PATCH 1/2] bugfix: store vehicle, getclosestplayer, banking --- client/job.lua | 14 +++++++------- client/laststand.lua | 4 ++-- client/main.lua | 3 +-- server/main.lua | 4 ++-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/client/job.lua b/client/job.lua index 8a0629b..a1c8343 100644 --- a/client/job.lua +++ b/client/job.lua @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/client/laststand.lua b/client/laststand.lua index be653e6..27b2d2f 100644 --- a/client/laststand.lua +++ b/client/laststand.lua @@ -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 diff --git a/client/main.lua b/client/main.lua index 3b2bdf7..14d1fbc 100644 --- a/client/main.lua +++ b/client/main.lua @@ -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) diff --git a/server/main.lua b/server/main.lua index d104c06..d892a15 100644 --- a/server/main.lua +++ b/server/main.lua @@ -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) + exports['Renewed-Banking']:addAccountMoney("ambulance", sharedConfig.checkInCost) TriggerClientEvent('hospital:client:SendBillEmail', player.PlayerData.source, sharedConfig.checkInCost) end @@ -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) From 5ac34ccb4aacdabbd51485001f3d154343b12093 Mon Sep 17 00:00:00 2001 From: solareon <769465+solareon@users.noreply.github.com> Date: Thu, 30 Nov 2023 16:12:15 +0000 Subject: [PATCH 2/2] Move society deposit to config --- config/server.lua | 3 +++ server/main.lua | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/server.lua b/config/server.lua index 55e3c6c..7d3204c 100644 --- a/config/server.lua +++ b/config/server.lua @@ -1,4 +1,7 @@ return { doctorCallCooldown = 1, -- Time in minutes for cooldown between doctors calls wipeInvOnRespawn = true, -- Enable ro disable removing all items from player on respawn + depositSociety = function(society, amount) + exports['Renewed-Banking']:addAccountMoney(society, amount) + end } \ No newline at end of file diff --git a/server/main.lua b/server/main.lua index d892a15..b31fe10 100644 --- a/server/main.lua +++ b/server/main.lua @@ -19,7 +19,7 @@ end ---@param player Player local function billPlayer(player) player.Functions.RemoveMoney("bank", sharedConfig.checkInCost, "respawned-at-hospital") - exports['Renewed-Banking']:addAccountMoney("ambulance", sharedConfig.checkInCost) + config.depositSociety("ambulance", sharedConfig.checkInCost) TriggerClientEvent('hospital:client:SendBillEmail', player.PlayerData.source, sharedConfig.checkInCost) end