Advertisement
szymski

HUD

Feb 4th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.48 KB | None | 0 0
  1. GAMESTATE_WAIT      =   -1
  2. GAMESTATE_BUILD     =   0
  3. GAMESTATE_GET       =   1
  4. GAMESTATE_DESTROY   =   2
  5. GAMESTATE_END       =   3
  6.  
  7. surface.CreateFont("Trebuchet21",{
  8.     font = "Trebuchet24",
  9.     size = 21,
  10.     weight = 500,
  11.     blursize = 0,
  12.     scanlines = 0,
  13.     antialias = true,
  14.     underline = false,
  15.     italic = false,
  16.     strikeout = false,
  17.     symbol = false,
  18.     rotary = false,
  19.     shadow = false,
  20.     additive = false,
  21.     outline = false,
  22. })
  23.  
  24. local health = 0
  25.  
  26.  
  27. local function FloodDrawHUD()
  28.     GAMEMODE.GameState = 1
  29.     GAMEMODE.NextState = CurTime() + 10
  30.  
  31.     local state = GAMEMODE.GameState
  32.     local quest  = ""
  33.     local posx   = 30
  34.     local posy   = ScrH() - 90
  35.    
  36.     if state == GAMESTATE_WAIT   then quest = "WAITING FOR PLAYERS"
  37.     elseif state == GAMESTATE_BUILD   then quest = "BUILD A BOAT "
  38.     elseif state == GAMESTATE_GET     then quest = "GET ON YOUR BOAT "
  39.     elseif state == GAMESTATE_DESTROY then quest = "DESTROY ENEMY BOATS "
  40.     elseif state == GAMESTATE_END     then quest = "RESTARTING THE ROUND "
  41.     end
  42.    
  43.     quest  = quest .. (state ==GAMESTATE_WAIT and "" or string.ToMinutesSeconds((GAMEMODE.NextState or CurTime()) - CurTime()))
  44.     health = (health *30 + LocalPlayer():Health())/31
  45.    
  46.     /* BACKGROUND */ draw.RoundedBox(0, posx, posy, 320, 77, Color(0,0,0,100))
  47.  
  48.     /* HEALTH     */ draw.RoundedBox(0, posx, posy, health /100 *320, 36, Color(237,50,0))
  49.    
  50.     /* QUEST      */ draw.DrawText(quest,"Trebuchet24",posx +320,posy -22,Color(255,255,255),TEXT_ALIGN_RIGHT)
  51.    
  52.     /* CASH       */ draw.DrawText("CASH","Trebuchet21",posx +3,posy +35,Color(200,200,200),TEXT_ALIGN_LEFT)
  53.                      draw.DrawText("$" .. LocalPlayer():GetMoney(),"Trebuchet21",posx +58,posy +35,Color(255,186,0),TEXT_ALIGN_LEFT)
  54.    
  55.     /* TEAM       */ draw.DrawText("TEAM","Trebuchet21",posx +3,posy +54,Color(200,200,200),TEXT_ALIGN_LEFT)
  56.                      draw.DrawText("FagTeam43","Trebuchet21",posx +59,posy +54,Color(255,186,0),TEXT_ALIGN_LEFT)
  57.    
  58.    
  59.     /* WINS       */ draw.DrawText("WINS","Trebuchet21",posx +317,posy +35,Color(200,200,200),TEXT_ALIGN_RIGHT)
  60.                      draw.DrawText("" .. LocalPlayer():GetWins(),"Trebuchet21",posx +251,posy +35,Color(255,186,0),TEXT_ALIGN_RIGHT)
  61.    
  62.     /* LOSES      */ draw.DrawText("LOSSES","Trebuchet21",posx +317,posy +54,Color(200,200,200),TEXT_ALIGN_RIGHT)
  63.                      draw.DrawText("" .. LocalPlayer():GetLosses(),"Trebuchet21",posx +251,posy +54,Color(255,186,0),TEXT_ALIGN_RIGHT)
  64. end
  65.  
  66. function GM:HUDPaint()
  67.     FloodDrawHUD()
  68. end
  69.  
  70. function GM:HUDShouldDraw(element)
  71.     if element == "CHudHealth" then
  72.         return false
  73.     end
  74.     return true
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement