Fps lags

Hello guys. After i started to make gamemode and hud, my gmod started to has too low fps. And i damn hate it. I’ve got fps less then 20! Sometimes only 15 and its on clear gm_construct. I think its because of the code and if you can, please help me with that. THX

Check the code:


function HUDHide( myhud )
	for k, v in pairs {"CHudHealth","CHudBattery","CHudAmmo","CHudSecondaryAmmo"} do
		if myhud == v then return false 
		end
	end
 end
 hook.Add("HUDShouldDraw","HUDHide",HUDHide)

 
 function GM:HUDPaint()
 if not LocalPlayer():Alive() then return end
 if (LocalPlayer():GetActiveWeapon() == NULL or LocalPlayer():GetActiveWeapon() == "Camera") then return end
 
 draw.RoundedBox(1, 150, 655, 35, 35, Color(71, 71, 71, 200))
 draw.RoundedBox(2, 184, 660, 265, 25, Color(71, 71, 71, 200))
 draw.RoundedBox(1, 1150, 655, 35, 35, Color(71, 71, 71, 200))
 draw.RoundedBox(2, 886, 660, 265, 25, Color(71, 71, 71, 200))
 draw.RoundedBox(12, 588, 635, 165, 105, Color(71, 71, 71, 200))

 	local ply = LocalPlayer()
	
	local HP = LocalPlayer():Health()
	
	surface.SetTextColor( 255, 64, 64, 255)
	surface.SetTextPos( 394, 664 )
	surface.SetFont( "MyFont" )
	surface.SetDrawColor( 50, 150, 50, 255)
	surface.DrawText( HP.."%" )

	surface.SetTexture(surface.GetTextureID("vgui/silkicons/heart"))
	surface.DrawTexturedRect(160,ScrH() - 102,14,16)


	
	local ARM = LocalPlayer():Armor()
	
	
	surface.SetTextColor( 0,245,255,255 )
	surface.SetTextPos( 902, 664 )
	surface.SetFont( "MyFont" )
	surface.SetDrawColor( 50, 150, 50, 255 )
	surface.DrawText( ARM.."%" )

	
	surface.SetTexture(surface.GetTextureID("vgui/silkicons/shield"))
	surface.DrawTexturedRect(1161,ScrH() - 102,14,16)
 

 	
	
	local Ammo = LocalPlayer():GetActiveWeapon():Clip1()
	if Ammo ==  (-1)  then return false
	end

	surface.SetTextColor( 255,255,0,180 )
	surface.SetTextPos( 600, 666 )
	surface.SetFont( "Ammo" )
	surface.SetDrawColor( 50, 150, 50, 255 )
	surface.DrawText( Ammo )
	
	
	

	
	
	local TotalAmmo = LocalPlayer():GetAmmoCount(LocalPlayer():GetActiveWeapon():GetPrimaryAmmoType())

	surface.SetTextColor( 255,255,0,140 )
	surface.SetTextPos( 674, 664 )
	surface.SetFont( "TotalAmmo" )
	surface.SetDrawColor( 255, 255, 0, 255 )
	surface.DrawText( TotalAmmo )
	
	

	local TotalAmmo = LocalPlayer():GetAmmoCount(LocalPlayer():GetActiveWeapon():GetSecondaryAmmoType())

	surface.SetTextColor( 255,69,0,255 )
	surface.SetTextPos( 725, 702 )
	surface.SetFont( "TotalAmmo" )
	surface.SetDrawColor( 255, 69, 0, 255 )
	surface.DrawText( TotalAmmo )
 end  
	

	surface.CreateFont( "MyFont", 
                    {
                    font    = "Coolvetica",
                    size    = 20,
                    weight  = 1000,
                    antialias = false,
                    shadow = false
 })
	surface.CreateFont( "Ammo", 
                    {
                    font    = "Impact",
                    size    = 65,
                    weight  = 800,
                    antialias = false,
                    shadow = false
 })
	surface.CreateFont( "TotalAmmo", 
                    {
                    font    = "Coolvetica",
                    size    = 40,
                    weight  = 1000,
                    antialias = false,
                    shadow = false
 })

Have you tried commenting this out?

[editline]13th January 2013[/editline]

Yeah its pretty laggy. Dropped me down from 90-100 fps to 60-80 depending on what I looked at.

Do not keep creating tables/colors every frame and cache the texture id’s.

What do you mean? Should i remove draw.RoundedBox from function?

Your question was already answered from a thread you posted about the same thing a day ago…

You came on that thread to tell me what i did a day ago? It helped me, still its happen again. I tried to change code and more stuff, still fps is bullshit. So i asked again, cant really play with 10 fps.