[Dev-Resource] Mythic Hospital (Body Part Damage & Healing)

Hi,
How can I disable esx_ambulancejob death screen/timer once I die and get sent to the bed? I’ve tried multiple things and gone through this thread numerous times as well but got no luck. Perhaps someone can help me out? Would appreciate it.

Kind regards,
Rynaty.

In which vrp folder do I call the mythical hospital events? Wasn’t it supposed to only add items from the mythical hospital to the store? well that’s what ise and it didn’t work out … then I created more elements to cure you but that did work but that is not the mythical hospital so if you would help me where I should be doing that in vrp I would appreciate it

Will be posting lower pillbox edits today after work. Please note that i have done the edits on the first release of this this system so it will be up to you to update your copy with the edits.

Have you edited anything in the resource?

OneSync_Hospital.rar (40.7 KB)
Enjoy :slight_smile:

1 Like

Here is my client side edits. This is based on the first ESX copy of this made. This is not a updated Mythic Hospital. I dont need the updated one so i haven’t updated it. It will be up to you to copy the parts needed to your updated copy of the script.

MLO used for lower Pillbox is [Release] Pillbox Hospital Interior (MLO)

Again here is the video so you know what this is for. https://showmore.com/u/1iqbzrm

local blips = {
  {name="Hospital", id=80, x= 365.02, y= -591.64, z= 28.69, color= 1},
  --{name="Hospital", id=80, x= -449.67, y= -340.83, z= 33.50, color= 1},
}                              


Citizen.CreateThread(function()
  for _, item in pairs(blips) do
    item.blip = AddBlipForCoord(item.x, item.y, item.z)
    SetBlipSprite(item.blip, item.id)
    SetBlipColour(item.blip, item.color)
    SetBlipAsShortRange(item.blip, true)
    BeginTextCommandSetBlipName("STRING")
    AddTextComponentString(item.name)
    EndTextCommandSetBlipName(item.blip)
  end
end)






local hospitalCheckin = { x = 340.02, y = -585.85, z = 28.79, h = 65.86 }
local pillboxTeleports = {    
    { x = 325.48892211914, y = -598.75372314453, z = 43.291839599609, h = 64.513374328613, text = 'Press ~INPUT_CONTEXT~ ~s~to go to lower Pillbox Entrance' },
    { x = 355.47183227539, y = -596.26495361328, z = 28.773477554321, h = 245.85662841797, text = 'Press ~INPUT_CONTEXT~ ~s~to enter Pillbox Hospital' },
    { x = 359.57849121094, y = -584.90911865234, z = 28.817169189453, h = 245.85662841797, text = 'Press ~INPUT_CONTEXT~ ~s~to enter Pillbox Hospital' },
}

local bedOccupying = nil
local bedOccupyingData = nil

local cam = nil

local inBedDict = "anim@gangops@morgue@table@"
local inBedAnim = "ko_front"
local getOutDict = 'switch@franklin@bed'
local getOutAnim = 'sleep_getup_rubeyes'
ESX = nil

Citizen.CreateThread(function()
	while ESX == nil do
		TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
		Citizen.Wait(0)
	end
end)

function PrintHelpText(message)
    SetTextComponentFormat("STRING")
    AddTextComponentString(message)
    DisplayHelpTextFromStringLabel(0, 0, 1, -1)
end

function LeaveBed()
    RequestAnimDict(getOutDict)
    while not HasAnimDictLoaded(getOutDict) do
        Citizen.Wait(0)
    end

    RenderScriptCams(0, true, 200, true, true)
    DestroyCam(cam, false)

    SetEntityHeading(PlayerPedId(), bedOccupyingData.h - 90)
    TaskPlayAnim(PlayerPedId(), getOutDict , getOutAnim ,8.0, -8.0, -1, 0, 0, false, false, false )
    Citizen.Wait(5000)
    ClearPedTasks(PlayerPedId())
    FreezeEntityPosition(PlayerPedId(), false)
    TriggerServerEvent('mythic_hospital:server:LeaveBed', bedOccupying)

    bedOccupying = nil
    bedOccupyingData = nil
end

RegisterNetEvent('mythic_hospital:client:RPCheckPos')
AddEventHandler('mythic_hospital:client:RPCheckPos', function()
    TriggerServerEvent('mythic_hospital:server:RPRequestBed', GetEntityCoords(PlayerPedId()))
end)

RegisterNetEvent('mythic_hospital:client:RPSendToBed')
AddEventHandler('mythic_hospital:client:RPSendToBed', function(id, data)
    bedOccupying = id
    bedOccupyingData = data
    SetEntityCoords(PlayerPedId(), data.x, data.y, data.z - 0.5)
    
    RequestAnimDict(inBedDict)
    while not HasAnimDictLoaded(inBedDict) do
        Citizen.Wait(0)
    end

    TaskPlayAnim(PlayerPedId(), inBedDict , inBedAnim ,8.0, -8.0, -1, 1, 0, false, false, false )
    SetEntityHeading(PlayerPedId(), data.h + 180)

    cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", 1)
    SetCamActive(cam, true)
    RenderScriptCams(true, false, 1, true, true)
    AttachCamToPedBone(cam, PlayerPedId(), 31085, 0, 0, 1.0 , true)
    SetCamFov(cam, 90.0)
    SetCamRot(cam, -90.0, 0.0, GetEntityHeading(PlayerPedId()) + 180, true)
            

    Citizen.CreateThread(function()
        while bedOccupyingData ~= nil do
            Citizen.Wait(1)
            PrintHelpText('Press ~INPUT_VEH_DUCK~ to get up')
            if IsControlJustReleased(0, 73) then
                LeaveBed()
            end
        end
    end)
end)

RegisterNetEvent('mythic_hospital:client:SendNurse')   ---new added for nurse to spawn and walk you to your bed
AddEventHandler('mythic_hospital:client:SendNurse', function(id, data)

			--Citizen.Wait(1000)
			--nped = CreatePed(4, "csb_mweather", x1, y1, z1, 0.0, true, true)
			SpawnedPed = CreatePed(4,"s_m_m_doctor_01", 333.69, -581.89, 28.79, 236.08, true, true)
			
			Citizen.Wait(2000)
			TaskGoStraightToCoord(SpawnedPed, 341.64, -584.85, 28.79, 1.0, -1, 340.92, 0.0)
			Citizen.Wait(6000)
			TaskGoStraightToCoord(SpawnedPed, 348.01, -563.28, 28.79, 1.0, -1, 244.15, 0.0)
			Citizen.Wait(14000)
			TaskGoStraightToCoord(SpawnedPed, 344.24, -572.21, 28.79, 1.0, -1, 71.92, 0.0)
			Citizen.Wait(8000)
			TaskGoStraightToCoord(SpawnedPed, 335.08, -568.12, 28.79, 1.0, -1, 64.62, 0.0)
			Citizen.Wait(15000)
			DeletePed(SpawnedPed)

end)

Citizen.CreateThread(function()
    
    RequestModel(GetHashKey("s_m_m_doctor_01"))
    while not HasModelLoaded(GetHashKey("s_m_m_doctor_01")) do
      Wait(1)
    end

      local hospitalped =  CreatePed(4, 0xd47303ac, 338.72, -585.27, 27.79, 244.48, false, true)
      SetEntityHeading(hospitalped, 244.48)
      FreezeEntityPosition(hospitalped, true)
      SetEntityInvincible(hospitalped, true)
      SetBlockingOfNonTemporaryEvents(hospitalped, true)
end)


RegisterNetEvent('mythic_hospital:client:SendToBed')  edited for you to walk to you bed and then get in it
AddEventHandler('mythic_hospital:client:SendToBed', function(id, data)
    bedOccupying = id
    bedOccupyingData = data
	local playerPed = PlayerPedId()
	TriggerEvent('mythic_hospital:client:SendNurse')
		Citizen.Wait(7000)
	exports['mythic_notify']:DoHudText('inform', 'Please follow the nurse!')
		Citizen.Wait(2000)
		TaskGoStraightToCoord(playerPed, 349.13, -562.65, 28.79, 1.0, -1, 263.74, 0.0)
		Citizen.Wait(15000)
		TaskGoStraightToCoord(playerPed, 353.59, -563.88, 28.79, 1.0, -1, 188.66, 0.0)
		Citizen.Wait(2000)
    SetEntityCoords(PlayerPedId(), data.x, data.y, data.z - 0.3)
    RequestAnimDict(inBedDict)
    while not HasAnimDictLoaded(inBedDict) do
        Citizen.Wait(0)
		
    end
    TaskPlayAnim(PlayerPedId(), inBedDict , inBedAnim ,8.0, -8.0, -1, 1, 0, false, false, false )
    SetEntityHeading(PlayerPedId(), data.h + 180)

    cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", 1)
    SetCamActive(cam, true)
    RenderScriptCams(true, false, 1, true, true)
    AttachCamToPedBone(cam, PlayerPedId(), 31085, 0, 0, 1.0 , true)
    SetCamFov(cam, 90.0)
    SetCamRot(cam, -90.0, 0.0, GetEntityHeading(PlayerPedId()) + 180, true)

    Citizen.CreateThread(function ()
        Citizen.Wait(5)
        local player = PlayerPedId()

        exports['mythic_notify']:DoHudText('inform', 'Doctors Are Treating You')
        Citizen.Wait(5000)
		  SendNUIMessage({
		     displayWindow = 'false'
		     })
		  isUiOpen = true
		  Citizen.Wait(15000)
		  
		  Citizen.Wait(90000)
                TriggerServerEvent('mythic_hospital:server:EnteredBed')
    end)
end)

RegisterNetEvent('mythic_hospital:client:FinishServices')  --edited for you to walk out of bed and back to lobby
AddEventHandler('mythic_hospital:client:FinishServices', function()
	local playerPed = PlayerPedId()
	SetEntityHealth(PlayerPedId(), GetEntityMaxHealth(PlayerPedId()))
    TriggerEvent('mythic_hospital:client:RemoveBleed')
    TriggerEvent('mythic_hospital:client:ResetLimbs')
    exports['mythic_notify']:DoHudText('inform', 'You\'ve Been Treated & Billed')
    LeaveBed()
	Citizen.Wait(3000)
	TaskGoStraightToCoord(playerPed, 352.41, -563.52, 28.79, 1.0, -1, 324.15, 0.0)
	Citizen.Wait(4000)
	TaskGoStraightToCoord(playerPed, 346.43, -567.04, 28.79, 1.0, -1, 120.74, 0.0)
	Citizen.Wait(4000)
	TaskGoStraightToCoord(playerPed, 341.22, -577.87, 28.79, 1.0, -1, 212.89, 0.0)
end)

RegisterNetEvent('mythic_hospital:client:ForceLeaveBed')
AddEventHandler('mythic_hospital:client:ForceLeaveBed', function()
    LeaveBed()
end)
---Make Damage Persistant (Disable Auto-Heal)
SetPlayerHealthRechargeMultiplier(PlayerId(), 0.0)

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(1)
			local plyCoords = GetEntityCoords(PlayerPedId(), 0)
            local distance = #(vector3(hospitalCheckin.x, hospitalCheckin.y, hospitalCheckin.z) - plyCoords)
            if distance < 10 then
                --DrawMarker(27, hospitalCheckin.x, hospitalCheckin.y, hospitalCheckin.z - 0.99, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 1.0, 1, 157, 0, 155, false, false, 2, false, false, false, false)

                if not IsPedInAnyVehicle(PlayerPedId(), true) then
                    if distance < 1 then
                        --PrintHelpText('Press ~INPUT_CONTEXT~ ~s~to check in')
			ESX.Game.Utils.DrawText3D(vector3(hospitalCheckin.x, hospitalCheckin.y, hospitalCheckin.z + 0.5), '[E] Check in', 0.4)
                        if IsControlJustReleased(0, 54) then
                            if (GetEntityHealth(PlayerPedId()) < 300) or (IsInjuredOrBleeding()) then
                                exports['mythic_progbar']:Progress({
                                    name = "hospital_action",
                                    duration = 10500,
                                    label = "Checking In",
                                    useWhileDead = false,
                                    canCancel = true,
                                    controlDisables = {
                                        disableMovement = true,
                                        disableCarMovement = true,
                                        disableMouse = false,
                                        disableCombat = true,
                                    },
                                    animation = {
                                        animDict = "missheistdockssetup1clipboard@base",
                                        anim = "base",
                                        flags = 49,
                                    },
                                    prop = {
                                        model = "p_amb_clipboard_01",
                                        bone = 18905,
										coords = { x = 0.10, y = 0.02, z = 0.08 },
										rotation = { x = -80.0, y = 0.0, z = 0.0 },
                                    },
                                    propTwo = {
                                        model = "prop_pencil_01",
                                        bone = 58866,
										coords = { x = 0.12, y = 0.0, z = 0.001 },
										rotation = { x = -150.0, y = 0.0, z = 0.0 },
                                    },
                                }, function(status)
                                    if not status then
                                        TriggerServerEvent('mythic_hospital:server:RequestBed')
                                    end
                                end)
                            else
                                exports['mythic_notify']:DoHudText('error', 'You do not need medical attention')
                            end
                        end
                    end
                end
            else
                Citizen.Wait(1000)
            end
    end
end)
2 Likes

Just trigger the function ResetAll(), when the medkit is used.

did u get any fix ?

add this line on clint side script it will help u :slight_smile:
if - this line

is this the latest version of mythic?

im using standalone how do i add pricing, every time i check in its free i want player paying for check in

Add billing to the billing file in server

There is no instruction how do i do that? @Alzar

Because my resource doesn’t do billing, go to whatever framework or resource you’re using for billing to see how to deduct money

I tried to add this but its not working

@mythic_hospital/server/hospital/hospital/events.lua:66: attempt to index a nil value (global ‘xPlayer’)

I jump out from a car, and i did not take any bleedings or something like that, i use standalone version btw.

thanks you. Truely appreciate it! Was hoping @Nowimps8 would have updated but no luck :frowning:

Someone got an ESX version working good? Also with functionally billing etc

when the hidden hospital revives players the death screen from esx ambulancejob still stays up

I still get hurt, i check-in and still injuring all time? I try to use script that you show but not working. Please help