Skip to content
Open
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
12 changes: 8 additions & 4 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -641,20 +641,20 @@ RegisterNetEvent('hospital:client:RespawnAtHospital', function()
if Config.RespawnAtNearestHospital and #Config.Locations["hospital"] > 0 then
local closestHospital, lowestDist
local playerPed = PlayerPedId()

if playerPed > 0 and DoesEntityExist(playerPed) then
local playerCoords = GetEntityCoords(playerPed)

for i=1, #Config.Locations["hospital"] do
local dist = #(Config.Locations["hospital"][i]["location"] - playerCoords)

if closestHospital == nil or dist < lowestDist then
closestHospital = i
lowestDist = dist
end
end
end

if closestHospital ~= nil then
hospitalIndex = closestHospital
end
Expand Down Expand Up @@ -692,6 +692,10 @@ RegisterNetEvent('hospital:client:adminHeal', function()
TriggerServerEvent('hospital:server:resetHungerThirst')
end)

RegisterNetEvent('hospital:client:SetArmor', function (amount)
TriggerServerEvent('hospital:server:SetArmor', amount)
end)

RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
local ped = PlayerPedId()
TriggerServerEvent('hospital:server:SetDeathStatus', false)
Expand Down