Custom Death Notice Issue

So I’m trying to make a custom death notice. I’m using the base gmod death notice as a “template”
But I can’t seem to change the default notice, when I draw it in my own file it still shows the default
death notice

Code (Its all of the deathnotice):



if SERVER then
	local GM = GAMEMODE
	local deathnotice_time = CreateConVar("deathnotice_time", "6", FCVAR_REPLICATED, "Amount of time to show death notice")
	local NPC_Color = Color(250,50,50,255)
	local deaths = {}


	function GM:AddDeathNotice(attacker, team1, inflictor, victim, team2)
		local death = {}
		death.time = CurTime()
		death.left = victim
		death.right = attacker
		death.phrase = nil

		if death.left == death.right then
			death.right = nil
			death.phrase = suicideMsg
		end

		table.insert(deaths, death)
	end

	local function DrawDeaths(x, y, death, deathnotice_time)
		local fadeout = (death.time + deathnotice_time) - CurTime()
		local alpha = math.Clamp(fadeout * 255, 0, 255)

		draw.SimpleText(death.left .. deathMsg .. death.right, "DeathNoticeFont", 20, ScrH() - 300, Color(255,255,255), TEXT_ALIGN_LEFT )
	end

	function GM:DrawDeathNotice( x, y )
	if (GetConVarNumber( "cl_drawhud" ) == 0) then return end
	local deathnotice_time = deathnotice_time:GetFloat()
		x = x * ScrW()
		y = y * ScrH()
	
		for k, death in pairs( deaths ) do
			if ( death.time + deathnotice_time > CurTime() ) then
				if ( death.lerp ) then
					x = x * 0.3 + death.lerp.x * 0.7
					y = y * 0.3 + death.lerp.y * 0.7
				end
		
				death.lerp = death.lerp or {}
				death.lerp.x = x
				death.lerp.y = y
				
				y = DrawDeaths( x, y, death, deathnotice_time )
			end
		end
		
		for k, death in pairs( deaths ) do
			if ( death.time + deathnotice_time > CurTime() ) then
				return
			end
		end
		deaths = {}
	end
end


Also those functions are clientside, not serverside.
That’s probably why.

And why are you doing local GM = GAMEMODE ?
Pretty sure GAMEMODE is nil until after it initializes

GM is nil after initialisation. GAMEMODE stays valid.

So put all of this in a clientside file, and hide the default deathnotice?

indeed, i think you may have mis-read.

GAMEMODE before init is nil, making his local nil.
i think, haven’t checked, plz no quote me :stuck_out_tongue:

yes.

wiki says the deathnotice shoulddraw doesn’t do anything so i don’t know if that part is needed, but for sure you won’t see anything at all unless what you got is put on the client.
Server doesn’t draw huds ;o

So I put the code into my main hud file and put it all into a local function which draws in a “HUDPaint” hook

Edit:
The reason I had


local GM = GAMEMODE

was just me trying to make it more simple (Instead of typing GAMEMODE:DrawDeathNotice, I would just have to type GM:DrawDeathNotice)