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 "
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)
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