[Modified-Release] Hospitalize : Send people to Hospitals Via Commands [NO SUPPORT]

Hello, thanks for your help, I am Spanish, the problem is that I only obey the command / hospital me, I live in the beds I put that teleported me and then if I die again and click / hospital I get the 180 seconds message , and neither teleport nor send me messages of seconds in chat, the file servidor.lua is equal to that, is the original downloaded from your Github account, I have the esx-qalle-jail, (https://github.com/qalle-fivem/esx-qalle-jail).

EDIT: I have disabled esx_qalle-jail but I still have the same problem, it only works the first time, we discard that it was the jail script that created conflict.

EDIT2: I had to put the script aside, I think the problem is with the ambulance system that makes only the command /hospitalme work for me only the first time, then when I healed and revived, the command no longer works. Thanks for your time and help.

hey hey. @ManuWarHD

If you look at line 48 in the clientHospital.

does it say:
cJ = false

if then try to change it to:
cH = false

1 Like

I didnt talk to you about the script but I have made a script that uses yours and Albos script is it alright with you if I modified yours and albos scripts again? I already have posted the resource and credited both of you but if you want me to take it down or find anything wrong with it that you don’t like then please make sure to let me know and I will delete ASAP. The link to the resource is here [Release] Mental Hospital for players who seemed crazy in RP scenes.

Hey there feel free to use it from my end. But you will have to contact Albo for his permission.

Yea I already have tried contacting Albo waiting for the response. But thank you for your time.

No problem.

This is a great script but there are some problems. Soo you can do it to one person and if the other person tries/gets booked into hospital they don’t get teleported in. So I’m forced to restart the whole script so the teleport can work. So after I restart the script, I went and booked someone in the hospital with that being said it worked perfectly fine but when I tried to book the second person on that chat it said they’ve been admited but they didn’t because they didn’t got teleported…

So you are saying that whenever you use it one person, it no longer works unless you restart the script?

YEP. I try to send the second one, it shows they get hospitalized but never teleport and never get the time.

Do you the Jailer script installed? (By Albo)
Have you edited anything on this script?

No. I don’t have that Jailer script. I have another jailer scrip and no, I did not edit anything.

Can’t go to bed directly.

This script does not take you to the bed directly. It just puts you in the hospital and if you try leaving it will put back in again increasing your time as if you had an injry trying to escape.

how do I change location to sandy hospital

Simply change the coordinates in the clientHospital.lua to the coordinates in the Sandy Shores Hospital.

--Coded by Albo1125.
-- /////// I take no credits for this, this was 100% coded by Albo1125./////
--Modified by Kevin.

local cH = false
local eHE = false

RegisterNetEvent("HP")
AddEventHandler("HP", function(hT)
	if cH == true then
		return
	end
	local pP = GetPlayerPed(-1)
	if DoesEntityExist(pP) then

		Citizen.CreateThread(function()
			local playerOldLoc = GetEntityCoords(pP, true)
			SetEntityCoords(pP, 360.28, -591.07, 43.31) -- Where the ped would spawn
			cH = true
			eHE = false
			while hT > 0 and not eHE do
				pP = GetPlayerPed(-1)
				RemoveAllPedWeapons(pP, true)
				SetEntityInvincible(pP, true)
				if IsPedInAnyVehicle(pP, false) then
					ClearPedTasksImmediately(pP)
				end
				if hT % 30 == 0 then
					TriggerEvent('chatMessage', 'SYSTEM', { 0, 0, 0 }, hT .." more seconds until release.")
				end
				Citizen.Wait(500)
				local pL = GetEntityCoords(pP, true)
				local D = Vdist(360.28, -591.07, 43.31, pL['x'], pL['y'], pL['z']) -- Where the ped would spawn
				if D > 90 then
					SetEntityCoords(pP, 360.28, -591.07, 43.31) -- Where the ped would spawn
					if D > 100 then
						hT = hT + 60
						if hT > 1500 then
							hT = 1500
						end
						TriggerEvent('chatMessage', 'DOCTOR', { 0, 0, 0 }, "Your hospital stay time was extended for an injury made during an escape attempt.")
					end
				end
				hT = hT - 0.5
			end
			TriggerServerEvent('chatMessageEntered', "SYSTEM", { 0, 0, 0 }, GetPlayerName(PlayerId()) .." was released from the hospital.")
			SetEntityCoords(pP, 298.22, -593.91, 43.26) -- Where the ped would leave from
			cJ = false
			SetEntityInvincible(pP, false)
		end)
	end
end)

RegisterNetEvent("UnHP")
AddEventHandler("UnHP", function()
	eHE = true
end)
--Coded by Albo1125
--Modified by Kevin.

any chance on sharing your version?

How do you change the distance in which it extends your time for trying to escape?

It seems broken, after I hospital one person the script breaks and no one after that can use it.

same issue here, have you found a fix?