Is it possible to only respawn when a button is pressed?

I cant get a script like this to work i have tried using getKeyPressed for the enter key. if someone could help me with this that would be appreciated. i cant find a definitive key code for enter the one i have been using is 13.

2 Likes

I am sure the check is “IsKeyPressed(int, int)”.

There is a script out there, that only respawns you (after death ofcourse) type a command in chat.

The RPDeathScript by Turtle is what i’m talking about.

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        if IsControlJustPressed(1, 18) and IsPlayerDead(ped) then
        	revivePed()
        	TriggerEvent("chatMessage", "::", {255, 0, 0}, "^1Revived :::")
        end
    end
end)

function revivePed(ped) -- Credits to @Turtle
	local ped = GetPlayerPed(-1)
	local playerPos = GetEntityCoords(ped, true)

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

Thanks for the help guys got it working. would not have been able to do it without you all.

4 year old topic