• Print

Author Topic: HUD help  (Read 4336 times)

0 Members and 1 Guest are viewing this topic.

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
HUD help
« on: February 13, 2015, 07:37:24 pm »
PROBLEM FIXED!!!!!!!!!!

Hello first of i will state my objective:

To make a awesome good looking DarkRP HUD

Now my current problem:

The words show up but the boxes DONT What do i do?

*Im putting this code in gmod/garrysmod/addons/darkrpmod/darkrp_modules/lmm_hud/cl_hud.lua*
^This is the right place!^

Now my code:

Code: Lua
  1. ----------------------------------------------
  2. --Made by: XxLMM13xXgaming
  3. ----------------------------------------------
  4.  
  5. --[[ Getting rid of the old HUD ]]--
  6. function HUDHide( myhud )
  7.         for k, v in pairs{"CHudHealth","CHudBattery"} do
  8.                 if myhud == v then return false end
  9.         end    
  10. end
  11. hook.Add("HUDShouldDraw","HudHide",HUDHide)
  12.  
  13. --[[ Making the words/boxes ]]--
  14.  
  15. --[[ Font ]]--
  16.  
  17. surface.CreateFont("TheDefaultSettings", {
  18.         font = "Arial",
  19.         size = 20,
  20.         weight = 500,
  21.         blursize = 0,
  22.         scanlines = 0,
  23.         antialias = true,
  24.         underline = false,
  25.         italic = true,
  26.         strikeout = false,
  27.         symbol = false,
  28.         rotary = false,
  29.         shadow = false,
  30.         additive = false,
  31.         outline = false,
  32. })
  33.  
  34. function HUDPaint()
  35.  
  36.     local ply = LocalPlayer()
  37.     local HP = LocalPlayer():Health()
  38.     local ARM = LocalPlayer():Armor()
  39.  
  40.     surface.SetTextColor( 0, 0, 0, 255 )
  41.     surface.SetTextPos( 125, 638 )
  42.     surface.SetFont( "TheDefaultSettings" )
  43.     surface.DrawText( "HP: "..HP)
  44.  
  45. end
  46.  
  47. function LMMHUD()
  48.        
  49.         local ply = LocalPlayer()
  50.         local HP = ply:Health()
  51.         local ARM = ply:Armor()
  52.  
  53.         draw.RoundedBox( 10, 50, ScrH() - 140, 275, 125, Color( 94, 94, 94, 255 )       )      
  54.         --Health Box +
  55.         draw.RoundedBox( 4, 90, ScrH() - 130, 200, 25, Color( 40, 40, 40, 150 ) )
  56.         draw.RoundedBox( 4, 90, ScrH() - 130, math.Clamp( HP, 1, 100 )*2, 25, Color( 255, 0, 0, 255 ) )
  57.         draw.RoundedBox( 4, 90, ScrH() - 130, 200, 50, Color( 40, 40, 40, 150 ) )
  58.     draw.RoundedBox( 4, 90, ScrH() - 105, math.Clamp( ARM, 1, 100 )*2, 25, Color( 0, 0, 255, 255 ) )  
  59.  
  60. end
  61. hook.Add( "HUDPaint", 'HUDPaint', HUDPaint )

Hope you can help again NO ERRORS at all! Thanks!
« Last Edit: February 14, 2015, 10:07:31 am by XxLMM13xX »

  • Print