NoDeadInJail ( No Dead in jail) V2 [ESX] [VRP]

hello to all, I share with you a simple script that allows the prisoner (and visitor)
who is in the prison area, not to die in prison with the status of invincibility player and Health player
(do not starve or thirst…) by creating a loop.

test in video Healt player and Invincibility player with Goku (dragonballz) :rofl:

thanks to @Xeon70782 for the soluce of the health of the player with esx and vrp
(if I have understand correctly, should also work for vrp)

1.the idea came to me with these scripts: (no dependence with these scripts)

if you use prisonfive maps, do not forget to disable line 706 in map.lua, otherwise door lock at the police station.
-- {hash = -1992828732, pos = vector3(434.69, -984.81, 29.6895943), cellblockDoor = false, dynamic = false, rot = vector3(1.00178859E-05, 5.00895567E-06, 89.9997253)},

if you do not want to be bothered by the prisoners PNJ.
I recommend this script: All the pnj ignores the players inside and outside the jail…
Everyone IgnoreYou

  • 1 the little players clever in my server have understood that by killing himself, he respawn directly to the hospital hence the importance of this script.
  • 2.I wanted an open environment of jail hence the importance of this script.
  • 3.I wanted to give the prisoner a chance to escape with [ESX-Release] esx_doorlock_mhacking without making a respawn zone or limit zone, hence the importance of this script

the ray and cordinnate was a test , maybe change the coordinates to be well in the middle of the prison and to put the radius smaller so that it goes up to the first double door ,but must cover the entire prison too…for rp and escape, it would be better…

local zones = { 

	{ ['x'] = 1641.78, ['y'] = 2641.07, ['z'] = 32.65} --here cordinate
} ....

if dist <= 250.0 then   -- here the ray 
			if not jailOut then	
				SetPlayerInvincible(GetPlayerIndex(),true)

link here:
NoDeadInJailv2

I am a beginner only two weeks ago that i began to make a server and knowledge of scripts. so tell me if you have a problem.

I’m inspired by this script, I do not want any credit,All Credit here.

3 Likes

Is ThIs vRp CoMpAtIbLe

2 Likes

This can all be done in one thread for optimization purposes, and also can be made standalone. That way we aren’t calling esx_basicneeds every tick.

local zones = { 
	{ ['x'] = 1641.78, ['y'] = 2641.07, ['z'] = 32.65}
}
Citizen.CreateThread(function()
	local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
	local distanceToJail = GetDistanceBetweenCoords(x, y, z, zones[i].x, zones[i].y, zones[i].z)
	while true do
		Citizen.Wait(500)
		if distanceToJail <= 250 then
			SetPlayerInvincible(GetPlayerIndex(),true)
		else
			SetPlayerInvincible(GetPlayerIndex(),false)
		end
	end
end)
1 Like

@Xeon70782 it’s good to know that it works with vrp, but after example for esx if you with invincibility you can still die if your vital needs are low like eating, drinking … hence the importance with esx_basicneeds for esx. after to vrp, I do not know the scripts of the vital needs and if you can die if you do not eat or drink with the invincibility mode …

Well in that case, you could repeatedly set the ped’s health to 200 while they are within the radius, and still not rely on ESX or vRP garbage

1 Like

@Xeon70782 okay I’ll test tomorrow in the day, it’s late , thanks for the information :wink:

@Xeon70782 peux-tu me dire si c’est bon pour vrp ? J’ai changé pour la santé du joueur , merci en tout cas pour l’information :wink:

you know that your code is wrong ? and you have to put getting distance stuff inside the loop as well ?

1 Like

@arcticx2 @Xeon70782
yes I tested the lines he gave me it had not worked, but I thank him anyway for the Healt player otherwise I would continue an addiction with esx_basicneeds. :upside_down_face::rofl:

if a person uses vrp can he tell me if this is good, that there is no problem? thank you for your feedback

this looks amazing, im trying to mess with a way to either increase everyone’s hp on my server or reduce all the weapon damage I cannot find any resources on here that does either one, im starting to think that there is no way. I want people to be less fragile. thanks for posting this, this may help me get closer to my goal!

This script only applies to AdminJail, of course.

its work but if player fall down then player not dead but abulancejob show dead and timer start