[Release] [Standalone] 1.1 MJ-DEATH | Death script

Hi there, today i am releasing my Death script that is apart of my ServerBase

Very simple text on screen script similar to NoPixel - When the timer is up Press E or type /revive

KNOWN BUGS:
Sometimes when you revive your UI will disapear, so If you use vMenu it will not open, not sure why this is.

Pictures:

Where you wake up:

Will do my best to provide support in comments.

Update 1.1

  • Added the animation function (May or may not have forgot it : ) )

Download

3 Likes

image

fx_version 'bodacious'
games { 'gta5' };

should be added in the top of the fxmanifest version.
Reference: https://docs.fivem.net/docs/scripting-reference/resource-manifest/resource-manifest/

also, Haven’t tried the script yet but looks like a nice script, Great job!

ty i have added

@MACJ45_PRODUCTIONSthat still dosnt work and is giving me the same error, resource wont start.

yes me to



Use this instead in the fxmanifest.lua

fx_version 'adamant'
games {'gta5'};

not this

fx_version 'bodacious'
games { 'gta5' };

Should work fine.

1 Like

Thank you @Clementinise, it starts up but i get this error now and it wont work.


https://gyazo.com/6dc927971c8f437893295ecb2a787e1f

That is not wrong if you are up to date, Just update your server artifact. But yes, That is a solution for older server versions I guess.

loadAnimDict is not defined as a function and not a fivem native either.

@MACJ45_PRODUCTIONS:
I guess you want to request a anim dict? you do it with RequestAnimDict(…).

1 Like

@ClataniiThis works, soo line 81 should be changed to RequestAnimDict

how can i use E to revive instead of respawn ?

Does this get glitched when you die multiple times in the same session? Happens to all death mechanics.

Btw great neatness in code.

For me it doesn’t show the text with seconds remaining and i can /revive instantly, even though i didn’t change any numbers

Firt of all let me appoloise for the lack of response,

The file has been updated to __resource.lua to make it easier for people.

@ClementiniseThank you for your assistance to others/
@yoinier28 & @Clatanii i have updated the git and the files should be fixed.
@yoinier28 Remove line 45 in the updated code

@TheDestroyerNot quite sure what you mean by that.
@daZepelin Ya: replace this line in the revive command “if IsDead == true then” with
"if IsDead == true and secondsRemaining = < 1 then "

Hope this helped some of you with answers!

2 Likes

I fix UI problem and rewrite script, this is my code

--------------------------------------------------------------------------------
------------------------------Death System--------------------------------------
--------------------------------------------------------------------------------
IsDead = false
local seconds = 150

function Draw3DText(x, y, z, text)
    SetTextScale(0.4, 0.4)
    SetTextFont(0)
    SetTextProportional(1)
    SetTextColour(255, 255, 255, 255)
    SetTextDropshadow(1, 1, 1, 1, 255)
    SetTextEdge(2, 0, 0, 0, 150)
    SetTextDropShadow()
    SetTextOutline()
    SetTextEntry("STRING")
    SetTextCentre(1)
    AddTextComponentString(text)
    SetDrawOrigin(x, y, z, 0)
    DrawText(0.0, 0.0)
    ClearDrawOrigin()
end

function IsPedDeath()
    local player = GetEntityCoords(PlayerPedId())
	if seconds > 1 then 
        Draw3DText(player.x, player.y, player.z, "~w~你已經死亡! 還有 ~r~" .. seconds .. "~w~ 秒後可以復活")
	end
   	if seconds < 1 then 
        Draw3DText(player.x, player.y, player.z, "~w~按 ~w~[~r~E~w~] 復活")
    end 
    if IsControlJustReleased(1, 38) and seconds < 1 then 
        local playerPos = GetEntityCoords(GetPlayerPed(-1), true)
        IsDead = false
        DoScreenFadeOut(1500)
        Citizen.Wait(1500)
        NetworkResurrectLocalPlayer(playerPos, true, true, false)
        SetPlayerInvincible(GetPlayerPed(-1), false)
        ClearPedBloodDamage(GetPlayerPed(-1))
        SetEntityHealth(GetPlayerPed(-1), 200) 
        DoScreenFadeIn(1500)
        seconds = 150
    end
end

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(1000)
        if seconds > 0 and IsDead == true then 
            seconds = seconds -1
        end
    end
end)

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        local health = GetEntityHealth(GetPlayerPed(-1))
        if health < 2 then
            IsDead = true  
        end
        if IsDead == true then
            exports.spawnmanager:setAutoSpawn(false)                
        	IsPedDeath()         
 	    end
	end
end)

And death screen :smiley:

after you die, it will not let you use the f1 menu vmenu, wont open, and removing line 45 wont work when it comes to removing spawn and only allowing players to revive after the X ammnt of time passed. @MACJ45_PRODUCTIONS

thanks i will use this so much in my server :slight_smile:

Worked great for me to fix the UI problem. Also I like the text appearing over the player, nice addition!

Correct is

fx_version 'bodacious'
game 'gta5'