I’m trying to setup drawText for when any player dies and only when they die this text will appear.
__resource.lua:
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
client_script {
'client.lua'
}
Client.lua:
Citizen.CreateThread(function()
alreadyDead = false
while true do
Citizen.Wait(50)
local playerPed = GetPlayerPed(-1)
if IsEntityDead(playerPed) and not alreadyDead then
TriggerEvent("drawText")
end
alreadyDead = true
end
if not IsEntityDead(playerPed) then
alreadyDead = false
end
end
end)
function drawText(x,y ,width,height,scale, text, r,g,b,a, outline)
SetTextFont(0)
SetTextProportional(0)
SetTextScale(scale, scale)
SetTextColour(r, g, b, a)
SetTextDropShadow(0, 0, 0, 0,255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
if(outline)then
SetTextOutline()
end
SetTextEntry("STRING")
AddTextComponentString("~r~You can use /revive in 2.5 minute's")
DrawText(x - width/2, y - height/2 + 0.005)
end