-- Open Hospital Menu
function OpenHospitalMenu()
ESX.TriggerServerCallback('esx_hospital:checkMoney', function(hasEnoughMoney)
ESX.TriggerServerCallback('npc-doktor:doktorvarmı',function(online)
if online >=2 then
exports['mythic_notify']:DoHudText('inform', "Şehirde doktor varken ben çalışmam!")
else
if hasEnoughMoney then
TriggerEvent('esx_ambulancejob:revive', formattedCoords)
TriggerServerEvent('esx_hospital:pay')
else
exports['mythic_notify']:DoHudText('inform', "Yeteri kadar paran yok!")
end
end
end)
end)
end
AddEventHandler('esx_hospital:hasEnteredMarker', function(zone)
CurrentAction = 'hospital_menu'
CurrentActionMsg = _U('press_access', ESX.Math.GroupDigits(Config.Price))
CurrentActionData = {}
end)
AddEventHandler('esx_hospital:hasExitedMarker', function(zone)
ESX.UI.Menu.CloseAll()
CurrentAction = nil
end)
RegisterNetEvent('esx_ambulancejob1:revive')
AddEventHandler('esx_ambulancejob1:revive', function()
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
TriggerServerEvent('esx_ambulancejob:setDeathStatus', false)
Citizen.CreateThread(function()
DoScreenFadeOut(800)
while not IsScreenFadedOut() do
Citizen.Wait(50)
end
local formattedCoords = {
x = ESX.Math.Round(coords.x, 1),
y = ESX.Math.Round(coords.y, 1),
z = ESX.Math.Round(coords.z, 1)
}
ESX.SetPlayerData('lastPosition', formattedCoords)
TriggerServerEvent('esx:updateLastPosition', formattedCoords)
RespawnPed(playerPed, formattedCoords, 0.0)
StopScreenEffect('DeathFailOut')
DoScreenFadeIn(800)
end)
end)