Place and Remove text on your HUD

I’m making a script that will tell you who killed you i have it so it will display it in chat, but i want to paste it on the hud using

font
surface.CreateFont( “msgfont”,
{
font = “coolvetica”,
size = 50,
weight = 40000,
antialias = true,
shadow = true
})

part that pastes it
draw.SimpleText(“text”, “msgfont”, ScrW() / 2 + 50, ScrH() - 63, Color(255,255,255,255), TEXT_ALIGN_TOP, TEXT_ALIGN_CENTER)

event
hook.Add(“PlayerDeath”,“Inform Murder Victims”,BitchPlease)

I am able to paste it on the screen, but then i have to change a boolean to false in the scrip to make it go away.
My main problem is how do i make it so when you die a boolean will turn true then after a couple seconds it will turn false.

[lua]timer.Simple(3, function() yourbool = false end)[/lua]

How do i declare my variable without having it turn to whatever i assign(true/false) it when the script loops?

well here is my code

AddCSLuaFile(“whokilledyou.lua”)
world = false
playerr = false

killed = false

function BitchPlease(victim,inflictor,killer)
timer.Simple(3, function() killed = true end)
if killer:IsPlayer() then
playerr = true
world = false

end

if playerr == false then
world = true

end

if playerr == true then

victim:PrintMessage(HUD_PRINTCENTER,killer:GetName()…" killed you!
")

end

if world == true then

victim:PrintMessage(HUD_PRINTCENTER,"Something/World killed you!
")

end

killr = killer:GetName()
surface.CreateFont( “msgfont”,
{
font = “coolvetica”,
size = 50,
weight = 40000,
antialias = true,
shadow = true
})

			local w, h = surface.GetTextSize( killr)

w = w + 5
h = h + 5
print(killed)
end
function HUDPaint()

if killr == nil and killed == true then
draw.SimpleText(“FuckProp”, “msgfont”, ScrW() / 2 + 50, ScrH() - 63, Color(255,255,255,255), TEXT_ALIGN_TOP, TEXT_ALIGN_CENTER)
end

if killed == true then
draw.SimpleText(“Fuck you dead”, “msgfont”, ScrW() / 2 + 50, ScrH() - 63, Color(255,255,255,255), TEXT_ALIGN_TOP, TEXT_ALIGN_CENTER)

end

if killed == false then

draw.SimpleText(“test2”, “msgfont”, ScrW() / 2 + 50, ScrH() - 63, Color(255,255,255,255), TEXT_ALIGN_TOP, TEXT_ALIGN_CENTER)

end


end

hook.Add(“PlayerDeath”,“Inform Murder Victims”,BitchPlease)
hook.Add(“HUDPaint”,“Inform Murder Victims”,HUDPaint)

If you mean if you could declare the variable with nothing in it, then you could just assign it nil, but in an if statement that will still return false. Just change the variable to true on PlayerDeath and use the code in my previous post to change it back to false.

Can i call on a variable in a function from another function?

Not sure where this is going. The problem I see is that you are either using PlayerDeath on clientside or HUDPaint on serverside. You have to use networking. Something like this.

[lua]
–serverside
util.AddNetworkString(“NotifyDeath”)
hook.Add(“PlayerDeath”,“Inform Murder Victims”, function(victim,inflictor,killer)
net.Start(“NotifyDeath”)
net.WriteString(killer:GetName())
net.Send(victim)
victim:PrintMessage(HUD_PRINTCENTER,killer:GetName ()…" killed you!
")
end)

–Clientside
local showDeath = false
local killer = nil
net.Receive(“NotifyDeath”, function(len)
killer = net.ReadString()
showDeath = true
timer.Simple(3, function()
showDeath = false
killer = nil
end)
end)

hook.Add(“HUDPaint”, “DisplayDeathStuff”, function()
if killer and showDeath then
//do your drawing here
//killer = name of player
end
end)
[/lua]

AddCSLuaFile(“whokilledyou.lua”)
world = false
playerr = false

function playerkilled(victim,inflictor,killer)

killed = true
timer.Simple(3, function()
killed = false
end)
if killer:IsPlayer() then
playerr = true
world = false

end

if playerr == false then
world = true

end

end
function HUDPaint()
surface.CreateFont(“msgfont”,
{
font = “coolvetica”,
size = 50,
weight = 40000,
antialias = true,
shadow = true
})

if killr == nil and killed == true then
draw.SimpleText(“FuckProp”, “msgfont”, ScrW() / 2 + 50, ScrH() - 63, Color(255,255,255,255), TEXT_ALIGN_TOP, TEXT_ALIGN_CENTER)
end

if killed == true then
draw.SimpleText(“Fuck u ded”, “msgfont”, ScrW() / 2 + 50, ScrH() - 63, Color(255,255,255,255), TEXT_ALIGN_TOP, TEXT_ALIGN_CENTER)

end

if killed == false then

draw.SimpleText(“test”, “msgfont”, ScrW() / 2 + 50, ScrH() - 63, Color(255,255,255,255), TEXT_ALIGN_TOP, TEXT_ALIGN_CENTER)

end


end

hook.Add(“PlayerDeath”,“Inform Murder Victims”,BitchPlease)
hook.Add(“HUDPaint”,“Inform Murder Victims”,HUDPaint)

That other stuff was the first working one. I removed it and have the new code i want.

Could you please put your code inside [LUA.][/LUA.] but remove the points " . "