Advertisement
Guest User

Gmod Code 2.0

a guest
Nov 4th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.00 KB | None | 0 0
  1. include( 'shared.lua' )
  2.  
  3.  
  4. --[[---------------------------------------------------------
  5.                         Custom HUD
  6. ---------------------------------------------------------]]--
  7.  
  8. function HUDHide ( myhud )
  9.    for k, v in pairs{"CHudHealth", "CHudBattery", "CHudAmmo", "CHudSecondaryAmmo"} do
  10.       if myhud == v then return false end
  11.    end
  12. end
  13. hook.Add("HUDShouldDraw","HUDHide",HUDHide)
  14.  
  15. -- HERE IS THE PROBLEM --
  16.  
  17. function GM:HUDPaint()
  18.     self.BaseClass:HUDPaint()
  19.     local Ammo = LocalPlayer():GetActiveWeapon():Clip1()
  20.     local SAmmo = LocalPlayer():GetActiveWeapon():Clip2()
  21.     surface.CreateFont("CloseCaption_Bold", {size = 50, weight = 300, antialias = false, shadow = false, font = "FontAmmo"})
  22.     surface.SetTextColor( 20, 180, 50, 255 )
  23.     surface.SetTextPos( 30, ScrH() - 165 )
  24.     surface.SetFont( "FontAmmo" )                                 -- This area is where the problem is! --
  25.     surface.DrawText( Ammo )
  26.    
  27.     surface.CreateFont("CloseCaption_Normal", {size = 40, weight = 250, antialias = false, shadow = false, font = "FontSecAmmo"})
  28.     surface.SetTextColor( 20, 180, 50, 255 )                                                                                  
  29.     surface.SetTextPos( 60, ScrH() - 165 )  
  30.     surface.SetFont( "FontSecAmmo" )        
  31.     surface.DrawText( SAmmo )
  32. end
  33.  
  34. -- END OF PROBLEM --
  35.  
  36. function CoolHUD()
  37.     local ply = LocalPlayer()
  38.     local HP = ply:Health()
  39.     local ARM = ply:Armor()
  40.    
  41.     draw.RoundedBox( 4, 100, ScrH() - 100, 200, 40, Color( 40, 40, 40, 120 ) )
  42.     draw.RoundedBox( 4, 100, ScrH() - 100, math.Clamp( HP, 0, 200 )*2, 40, Color( 220, 108, 108, 255 ) )
  43.     draw.RoundedBox( 4, 100, ScrH() - 100, math.Clamp( HP, 0, 200 )*2, 15, Color( 255, 255, 255, 40 ) )
  44.    
  45.     draw.RoundedBox( 4, 100, ScrH() - 145, 200, 40, Color( 40, 40, 40, 120 ) )
  46.     draw.RoundedBox( 4, 100, ScrH() - 145, math.Clamp( ARM, 0, 200 )*2, 40, Color( 108, 108, 220, 255 ) )
  47.     draw.RoundedBox( 4, 100, ScrH() - 145, math.Clamp( ARM, 0, 200 )*2, 15, Color( 255, 255, 255, 40 ) )
  48. end
  49. hook.Add( "HUDPaint", "CoolHUD", CoolHUD )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement