Delete me 3

I’m trying to edit the hospital command to make it jail but you go to the jail and it teleports you back and forth from the morgue to the jail (i presume this was so people dont noclip out of morgue) but where do I change the location?

The jail is not an interior so checking if you are inside the jail is a bit more challenging. If you just want to disable the feature that checks if you are inside the morgue then remove the interiorID check.

if (not (GetInteriorFromEntity(ped) == interiorID) ) then 
    inMorgue = false
end

This should stop you from teleporting back to the morgue.

How i can add only hospital door teleport?

Love the script man! Is there anyway to make it so you can respawn with a button instead of typing /revive?

Trigger the code where I am checking for /respawn when a button is pressed instead.

https://wiki.fivem.net/wiki/Controls

Yeah, it respawns you with the button press, but it also still respawns automatically. I tried putting this part from RPDeath in it and it still didn’t work right.

-- Turn off automatic respawn here instead of updating FiveM file.
AddEventHandler('onClientMapStart', function()
	Citizen.Trace("RPDeath: Disabling autospawn...")
	exports.spawnmanager:setAutoSpawn(false)
	exports.spawnmanager:spawnPlayer()
	Citizen.Trace("RPDeath: Autospawn disabled!")
end)

I also tried what @TheStonedTurtle said, though im most likely doing this all wrong.
Changing this

		if (cmd == "/respawn") then
			CancelEvent()
			TriggerClientEvent('RPD:allowRespawn', from)
		end

to this

        if IsControlJustPressed(1, 18) then
			CancelEvent()
			TriggerClientEvent('RPD:allowRespawn', from)
		end

but that just screws the whole thing

Are you forcing a IsPlayerDead(ped) check? Else it will always think you want to respawn
You are also sending an event from the player pressing the key, guessing thats where it bugs for you?

the link you sent me is exactly what I put in my client file.

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        if IsControlJustPressed(1, 18) and IsPlayerDead(ped) then
        	revivePed()
        	TriggerEvent("chatMessage", "::", {255, 0, 0}, "^1Revived :::")
        end
    end
end)

function revivePed(ped) -- Credits to @Turtle
	local ped = GetPlayerPed(-1)
	local playerPos = GetEntityCoords(ped, true)

	NetworkResurrectLocalPlayer(playerPos, true, true, false)
	SetPlayerInvincible(ped, false)
	ClearPedBloodDamage(ped)
end

and you added the no respawn function? should work just fine, atleast it does for me.

well I put it like this, which I’m sure is wrong but I don’t know enough to know why

-- Turn off automatic respawn here instead of updating FiveM file.
AddEventHandler('onClientMapStart', function()
	exports.spawnmanager:setAutoSpawn(false)
	exports.spawnmanager:spawnPlayer()
end)

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        if IsControlJustPressed(1, 18) and IsPlayerDead(ped) then
        	revivePed()
        end
    end
end)

function revivePed(ped) -- Credits to @Turtle
	local ped = GetPlayerPed(-1)
	local playerPos = GetEntityCoords(ped, true)

	NetworkResurrectLocalPlayer(playerPos, true, true, false)
	SetPlayerInvincible(ped, false)
	ClearPedBloodDamage(ped)
end

It works perfectly for me, what exactly is bugging for you?

I cleared all my extra resources off before I tested this just to be sure. It still autorespawns, the button works as long as you push it before you respawn. Though it works correctly if I change this in spawnmanager to false.

-- changes the auto-spawn flag
function setAutoSpawn(enabled)
    autoSpawnEnabled = false
end

are you adding the resource after you connect to the server? then it would never update as you already have the map loaded

Are you referring to the order of resources in the citmp-server.yml? Or are you saying making changes while the server is still running?

are you connected to the server when you start the respawn/revive resource?
I have no idea as to why it isn’t working for you, try clearing cache

I don’t really understand what you mean. I start the server then start the fivem up and join the server. I spawn as the skater kid, noclip into the sky and suicide, and it’ll fade out and respawn me at a spawnpoint if I don’t press the button.

This should be working, you probably have another piece of code that is also handling spawns which overrides this.

Well I made a completely new server and had only this script on, and it works but only for the first connected player. The other player just dies, ragdolls, and can’t respawn.

is there a way to stop RPDeath from spawning people randomly? when they first join the server? i have a script that spawns people in paleto but if i add this one it makes people spawn in different areas.

is it also possible to make it so instead of toggling no respawon on death that its just always on so they got to /respawn to be /revived?