Delete me 3

A few months ago I released three scripts and then removed them as I was using them for a private community. I am no longer a part of that community and have decided that the entire FiveM community deserves to benefit from these if they’d like too.

Hospital Script: Similar to the /jail command but will send players to the morgue and prevent them from leaving for X seconds (capped at 600 seconds). Can specify a hospital to teleport player back to or they can teleport outside the morgue.

Source Code: https://github.com/TheStonedTurtle/FiveM-Hospital
Demo Video: https://www.youtube.com/watch?v=M6IHRsHVaZM&feature=youtu.be
Requires OPEN INTERIORS to be installed for each user. https://lambda.menu
I Haven’t personally tested this but I have been told this is a server-sided solution for OPEN INTERIORS: [RELEASE] Fix holes in the map

RPDeath Script: Prevent automatic respawn, player will stay dead until they are revived or respawn via a chat command. There is a command to toggle this per person so they will automatically respawn at one of the 5 hospital locations. Prevents players from respawning themselves for 300seconds, can be changed at the top of client.lua

Source Code: https://github.com/TheStonedTurtle/FiveM-RPDeath
Demo Video: https://www.youtube.com/watch?v=_E__t26pSnw

Please do not redistribute these files without my permission unless it has been modified. If the code has been modified please give me some credit unless you feel you’ve changed so much I don’t deserve any.

If you find any huge issues with these scripts let me know and I’ll attempt to fix them.
Please ensure any issues are issues caused soley by RPDeath and not another resource conflicting with mine. Most likely issue is another resource turning the setAutoSpawn() back on.

10 Likes

Thanks for sharing.
Am I correct in thinking that if, say, one player is in the Paleto morgue and one in the Sandy Shores morgue, they will still be able to see each other in the interior?

Yes you are correct, the interior is the morgue which is located in the city across from the hospital. To visit you have to enter the building like I showed in the video, the hospital ID is just meant to teleport players back to the right area on the map for the RP reasons.

EDIT: I’m not sure if you can instance interiors so the same interior is only shown to certain people.

Well Rockstar does this with the garages, apartments and bunker so it’s just a matter of figuring out how they do it. Working on that right now.
Again thanks for the contribution.

1 Like

how to make the RPDeath Script remove money on death?

I think the easiest way would be to create custom events and trigger them when my script respawns the ped. The below is triggered when they respawn, since if you revive someone they might want to keep their money.

Server:

RegisterServerEvent("RPD:playerRespawned")
AddEventHandler("RPD:playerRespawned",function(from)
end)

then at the end of the if (allowRespawn) code (after the math.randomseed) Trigger that event via TriggerServerEvent("RPD:playerRespawned")

1 Like

nice, thanks for your help

Would this code work, so its only people with EMS uniform, that can revive?

local PedModels = {
        "S_M_M_Doctor_01",

IsPedModel(ped, GetHashKey("S_M_M_Doctor_01")) should be what you’re looking for.

In server right? or am i wrong?

Very wrong.
Natives are client-side functions.

Then where to put the code in? so it only is EMS that can revive pple

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?