[Release] RP Revive [Fax-Revive] [1.1]

:fax: RP Revive :fax:

Created by: FAXES


RP Revive is a new style Revive script, inspired by DoJ’s revive script this script uses keybindings instead of text chat commands. I plan to add more features very soon some including a timer and config.

Features:

  • Reviving
  • Configure time to have users wait before reviving
  • Respawning
  • Admin bypass for reviving timer. This uses discordroles

Download:

Credits:
@TheStonedTurtle for some base work.
@dibzer testing

If you have any issues or comments please put them below :grinning:

27 Likes

Lovely work. As usual.

1 Like

Is there a way to make it so it doesn’t disable the pause menu when you die?

That’s to stop combat loggers

Anyone can just open console with F8 and type ‘quit’. Or use task manager to close FiveM. Or alt+f4 out of FiveM.

2 Likes

I will 100% use this when a timer comes out :smiley:

1 Like

haha true

Give me a shout if you need help with a timer boiiiii

1 Like

sure thing maaaaaaaaaaaaan

1 Like

Yeah sooooo like I autorespawn but I still get the diolouge

1 Like

Its still in beta, I have not finished it yet…

I have my own version I develeped before this came out if you want to test it Faxes, DM me on discord.

3 Likes

In my case the message appears after 90 secs but disappears from the screen after a few seconds and the function of the buttons goes out (can only work while message is on the screen 10 secs thing) could help me?

1 Like

Soooo I died, the thing popped up but I just respawned automatically, do you know how to fix this?

It should not as it says it’s a beta version…

Well it does…
(20 characters)

I’ll check it out when I next have time…

1 Like

I noticed on other servers that they have the auto respawn disabled when I press F8. How do I do that?

Oh wait… I got. I was messing with the code and it works now @FAXES thanks for the script. If anyone is looking how to here take this and plop it in the client.lua

--------------------------------
--- RP Revive, Made by FAXES ---
--------------------------------

local reviveWait = 15 -- Change the amount of time to wait before allowing revive (in seconds) (This feature is not in use yet!)

-- Turn off automatic respawn here instead of updating FiveM file.
AddEventHandler('onClientMapStart', function()
	Citizen.Trace("RPRevive: Disabling autospawn.")
	exports.spawnmanager:spawnPlayer() -- Ensure player spawns into server.
	Citizen.Wait(2500)
	exports.spawnmanager:setAutoSpawn(false)
	Citizen.Trace("RPRevive: Autospawn is disabled.")
end)

function respawnPed(ped, coords)
	SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false, true)
	NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, false) 

	SetPlayerInvincible(ped, false) 

	TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, coords.heading)
	ClearPedBloodDamage(ped)
end

local allowRespawn = true

Citizen.CreateThread(function()
	local respawnCount = 0
	local spawnPoints = {}
	local playerIndex = NetworkGetPlayerIndex(-1) or 0
	math.randomseed(playerIndex)

	function createSpawnPoint(x1,x2,y1,y2,z,heading)
		local xValue = math.random(x1,x2) + 0.0001
		local yValue = math.random(y1,y2) + 0.0001

		local newObject = {
			x = xValue,
			y = yValue,
			z = z + 0.0001,
			heading = heading + 0.0001
		}
		table.insert(spawnPoints,newObject)
	end

	createSpawnPoint(-448, -448, -340, -329, 35.5, 0) -- Mount Zonah
	createSpawnPoint(372, 375, -596, -594, 30.0, 0)   -- Pillbox Hill
	createSpawnPoint(335, 340, -1400, -1390, 34.0, 0) -- Central Los Santos
	createSpawnPoint(1850, 1854, 3700, 3704, 35.0, 0) -- Sandy Shores
	createSpawnPoint(-247, -245, 6328, 6332, 33.5, 0) -- Paleto
	--createSpawnPoint(1152, 1156, -1525, -1521, 34.9, 0) -- St. Fiacre


    while true do
    Citizen.Wait(0)
		ped = GetPlayerPed(-1)
		if IsEntityDead(ped) then
			-- ShowInfoRevive('~r~You Are Dead ~w~Please wait ~y~'.. tostring(reviveWait) ..' Seconds ~w~ before choosing an action')

            SetPlayerInvincible(ped, true)
            SetEntityHealth(ped, 1)

			ShowInfoRevive('~y~ You Are Dead. ~w~Use ~p~E ~y~ to Revive or ~p~R ~y~to Respawn')

			if ( IsControlJustReleased( 0, 38 ) or IsDisabledControlJustReleased( 0, 38 ) ) and GetLastInputMethod( 0 ) then 
					revivePed(ped)
					
            elseif ( IsControlJustReleased( 0, 45 ) or IsDisabledControlJustReleased( 0, 45 ) ) and GetLastInputMethod( 0 ) then
                local coords = spawnPoints[math.random(1,#spawnPoints)]

				respawnPed(ped, coords)

				allowRespawn = true
				respawnCount = respawnCount + 1
				math.randomseed( playerIndex * respawnCount )
            end
        end
    end
end)

function revivePed(ped)
	local playerPos = GetEntityCoords(ped, true)

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

function ShowInfoRevive(text)
	SetNotificationTextEntry("STRING")
	AddTextComponentSubstringPlayerName(text)
	DrawNotification(true, true)
end

Nice. You should make a PR on the GitHub so people can access it easier

2 Likes