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.
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
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.
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.
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.
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.
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
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?