[Release] RP Revive [Fax-Revive] [0.9]

fivem-scripts
revive
respawn

#1

RP Revive By FAXES

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

In the Download

__resource.lua
client.lua


Requirements
None. This is a standalone script.

Downloads:


Usage
E to revive
R to respawn

Installation
Place in your resources folder, just like any other resource.

Credits
@TheStonedTurtle for some base work. @dibzer for being apart of my Official Community Testers

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


Death screen
I need help getting set in the right direction to make my first script
Spawn settings
#2

Lovely work. As usual.


#3

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


#4

That’s to stop combat loggers


#5

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


#6

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


#7

haha true


#8

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


#9

sure thing maaaaaaaaaaaaan


#10

Yeah sooooo like I autorespawn but I still get the diolouge


#11

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


#12

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


#13

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?


#14

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


#15

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


#16

Well it does…
(20 characters)


#17

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


#18

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


#19

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

#20

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