Not showing notifications!

Hello, I got my own gamemode that derives from sandbox, and I’m having this piece of code that will remove the default HUD so I place my custom one.
But I can’t see the notifications at all anymore. If you look at this code, is it it’s fault?
It’s nothing else that could block the notifications to be seen, but you can hear them.



function GM:HUDShouldDraw(name)
	if name == "CHudHealth" or
		name == "CHudBattery" or
		name == "CHudSuitPower" or
		(HelpToggled and name == "CHudChat") then
			return false
	else
		return true
	end
end


Why don’t you use this?

[lua]

function hidehud(name)
for k, v in pairs{“CHudHealth”, “CHudBattery”, “CHudAmmo”, “CHudSecondaryAmmo”} do
if name == v then return false end
end
end
hook.Add(“HUDShouldDraw”, “hidehud”, hidehud)
[/lua]

I’ve debuged my cl_init code a little now.
I’ve found the function that makes the notifications inivisble.
The code is:

[lua]
local healthold = 0
local armorold = 0
function GM:HUDPaint()
local client = LocalPlayer()
if !client:Alive() then return end
if client:GetActiveWeapon() == “Camera” then return end

local CurrentTime = CurTime()

// Time Variable
local min = math.floor((CurTime()/1.5)%1440)%60
local hour = math.floor(((CurTime()/1.5)%1440)/60)
if min < 10 then min = "0"..min end
if hour < 10 then hour = "0"..hour end
local TimeString = hour .. ":" .. min

// Textures
local Clock  = surface.GetTextureID( "shane/hud/clock" )
local Heart  = surface.GetTextureID( "gui/silkicons/heart" )
local Shield = surface.GetTextureID( "gui/silkicons/shield" )
local User = surface.GetTextureID( "gui/silkicons/user" )
local Group = surface.GetTextureID( "gui/silkicons/group" )
local Money = surface.GetTextureID( "gui/silkicons/money" )
local Money_Add = surface.GetTextureID( "gui/silkicons/money_add" )
local Wanted = surface.GetTextureID( "gui/silkicons/exclamation" )

draw.RoundedBox(8, 10, ScrH()-158, 250, 155, Color(25,  25, 25, 150)) // Main rounded box
// Name Label

draw.SimpleText( LocalPlayer():Nick(), "CloseCaption_Bold", 55, ScrH() - 150, Color( 255, 255, 255, 255 ) )

surface.SetTexture( User )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawTexturedRect( 25,  ScrH() - 150, 16, 16 )	

// Salary

draw.SimpleText("+$"..LocalPlayer():GetNWString("Salary"), "CloseCaption_Bold", 55, ScrH() - 125, Color( 255, 255, 255, 255 ) )

surface.SetTexture( Money_Add )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawTexturedRect( 25,  ScrH() - 125, 16, 16 )	

// Money

draw.SimpleText("$"..LocalPlayer():GetNWString("Money"), "CloseCaption_Bold", 55, ScrH() - 100, Color( 255, 255, 255, 255 ) )

surface.SetTexture( Money )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawTexturedRect( 25,  ScrH() - 100, 16, 16 )

// Job Name

draw.SimpleText(LocalPlayer():GetNWString("Job"), "CloseCaption_Bold", 55, ScrH() - 75, Color( 255, 255, 255, 255 ) )

surface.SetTexture( Group )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawTexturedRect( 25,  ScrH() - 75, 16, 16 )

// Armor

if LocalPlayer():Armor() != 0 then

armorold = math.Approach(armorold, LocalPlayer():Armor(), 1)
draw.RoundedBox( 1, 55, ScrH() - 28, math.Clamp(armorold/100,0,1)*180, 15, Color( 40, 170, 40, 200 ) )
draw.RoundedBox( 1, 55, ScrH() - 28, math.Clamp(armorold/100,0,1)*180, 7, Color( 255, 255, 255, 20 ) )

draw.SimpleText(armorold, "CloseCaption_Bold", 145, ScrH() - 28, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER)

surface.SetTexture( Shield )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawTexturedRect( 25,  ScrH() - 28, 16, 16 )

end

//Health Label
healthold = math.Approach(healthold, LocalPlayer():Health(), 1)
draw.RoundedBox(0, 55, ScrH()-50, math.Clamp(healthold/100,0,1)*180,15, Color( 255, 40, 40, 200 ))
draw.RoundedBox(0, 55, ScrH()-50, math.Clamp(healthold/100,0,1)*180,7, Color( 255, 255, 255, 20 ))		

draw.SimpleText( healthold, "CloseCaption_Bold", 145, ScrH() - 50, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER)

surface.SetTexture( Heart )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawTexturedRect( 25,  ScrH() - 50, 16, 16 )

// Clock
draw.RoundedBox(8, ScrW()-105, ScrH()-766, 90, 30, Color(25,  25, 25, 150))
draw.SimpleText(tostring(TimeString),"CloseCaption_Bold",ScrW()-70,ScrH()-760,Color(220,220,220,255),0,0)

surface.SetTexture( Clock )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawTexturedRect( ScrW()-90,  ScrH() - 760, 16, 16 )	


// Other
surface.SetDrawColor(0,0,0,200)

surface.DrawOutlinedRect( 55, ScrH()-50,180,15) // Health

if LocalPlayer():Armor() != 0 then
	surface.DrawOutlinedRect( 55, ScrH()-28,180,15) // Armor
end

end
[/lua]
It’s something inside here that makes it invisible.


Also, how to make Lua syntaxed code? [Lua] doesn’t work for me ?

Add this:
[lua]self.BaseClass.HUDPaint( self )[/lua]

[noparse][lua][/lua][/noparse]

Thanks! Works now :slight_smile:

I noticed that [lua] did work for me lol. It’s just that it didn’t showed it like here in the preview, made me think it didn’t work.