Guest User

Untitled

a guest
Jan 22nd, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.47 KB | None | 0 0
  1. BlackTea = BlackTea or {}
  2. local SH = ScrH()
  3. local SW = ScrW()
  4.  
  5. function BlackTea.HUDPaint()
  6.  
  7.     local ply = LocalPlayer()
  8.    
  9.     BlackTea.HealthInd( ply )
  10.    
  11.     if ply:Alive() then
  12.         BlackTea.Overlay( ply )
  13.         BlackTea.AmmoElement( ply )
  14.     else
  15.     end
  16.    
  17. end
  18. hook.Add("HUDPaint", "[BlackTea]HUDPaint", BlackTea.HUDPaint)
  19.  
  20. function BlackTea.HideDefault( name )
  21.  
  22.     local nodraw = {
  23.        
  24.         "CHudHealth",
  25.         "CHudSecondaryAmmo",
  26.         "CHudAmmo",
  27.         "CHudBattery",
  28.    
  29.     }
  30.    
  31.     for k, v in pairs( nodraw ) do
  32.    
  33.         if( v == name ) then
  34.         return false;
  35.         end
  36.    
  37.     end
  38.    
  39.     return true;
  40.  
  41. end
  42. hook.Add("HUDShouldDraw", "[BlackTea]HideHUD", BlackTea.HideDefault)
  43.  
  44. function BlackTea.EffectThink()
  45. end
  46. hook.Add("Think", "[BlackTea]EffectThink", BlackTea.EffectThink)
  47.  
  48. ----------------------------------------------
  49.  
  50. local HL2Weps = {
  51. ["weapon_pistol"] = 18,
  52. ["weapon_357"] = 6,
  53. ["weapon_smg1"] = 45,
  54. ["weapon_ar2"] = 30,
  55. ["weapon_shotgun"] = 6,
  56. }
  57.  
  58. function BlackTea.AmmoElement( ply )
  59.     local wep = ply:GetActiveWeapon()
  60.     local health = ply:Health()
  61.     local armor = ply:Armor()
  62.     if wep:IsValid() then
  63.  
  64.         local ammo = ply:GetAmmoCount( wep:GetPrimaryAmmoType() )
  65.         local maxammo = 0
  66.         if wep.Primary then
  67.             maxammo = wep.Primary.DefaultClip
  68.         else
  69.             if not HL2Weps[wep:GetClass()] then
  70.                 maxammo = 1
  71.             else
  72.                 maxammo = HL2Weps[wep:GetClass()]
  73.             end
  74.         end
  75.         if wep:GetPrimaryAmmoType() == 7 then
  76.             maxammo = 1
  77.         end
  78.        
  79.         local left = math.Round(ammo / maxammo)
  80.        
  81.         if wep:GetPrimaryAmmoType() == 10 or wep:GetPrimaryAmmoType() == 8 then
  82.             draw.DrawText( left , "HUDNumber5", SW - 98 , SH - 78,  color_black, 2)
  83.             draw.DrawText( left , "HUDNumber5", SW - 100 , SH - 80, color_white, 2)
  84.         elseif wep:GetPrimaryAmmoType() == 0 or wep:GetPrimaryAmmoType() == -1 then
  85.         else
  86.             draw.DrawText( wep:Clip1() , "HUDNumber5", SW - 98 , SH - 78, color_black, 2)
  87.             draw.DrawText( left , "ScoreboardText", SW - 88 , SH - 58, color_black, 3)
  88.             draw.DrawText( wep:Clip1() , "HUDNumber5", SW - 100 , SH - 80, color_white, 2)
  89.             draw.DrawText( left , "ScoreboardText", SW - 90 , SH - 60, color_white, 3)
  90.         end
  91.     end
  92. end
  93.  
  94. function BlackTea.Overlay( ply )
  95.     if not ply.WR then ply.WR = 0 end
  96.     if ply.WR > 0 then DrawMaterialOverlay( "models/shadertest/predator", ply.WR ) end
  97.     if ply:WaterLevel() >= 3 then
  98.         ply.WR = 0.15
  99.     else
  100.         ply.WR = ply.WR - RealFrameTime()*0.05
  101.         if ply.WR < 0 then ply.WR = 0 end
  102.     end
  103. end
  104.  
  105. veins = surface.GetTextureID( "whud/veins" )
  106. ring = surface.GetTextureID( "whud/redring" )
  107. function BlackTea.HealthInd( ply )
  108.     local hp = math.Clamp( ply:Health(), 0, 60 )
  109.     if hp ~= 60 then
  110.         local mat_alpha = 1 - ( hp / 60 )
  111.        
  112.         surface.SetDrawColor( 255, 255, 255, mat_alpha * 255 )
  113.         surface.SetTexture( veins )
  114.         surface.DrawTexturedRect( 0, 0, ScrW(), ScrH() )
  115.        
  116.         surface.SetDrawColor( 255, 255, 255, mat_alpha * 255 )
  117.         surface.SetTexture( ring )
  118.         surface.DrawTexturedRect( 0, 0, ScrW(), ScrH() )
  119.     end
  120. end
  121.  
  122. ---------------------------------------------------------------------------------------
  123.  
  124. local firefight = {
  125. { Sound = "ambient/levels/prison/inside_battle1.wav", Vol = 150 },
  126. { Sound = "ambient/levels/prison/inside_battle2.wav", Vol = 150 },
  127. { Sound = "ambient/levels/prison/inside_battle3.wav", Vol = 150 },
  128. { Sound = "ambient/levels/prison/inside_battle4.wav", Vol = 150 },
  129. { Sound = "ambient/levels/streetwar/city_battle2.wav", Vol = 150 },
  130. { Sound = "ambient/levels/streetwar/city_battle3.wav", Vol = 150},
  131. { Sound = "ambient/levels/streetwar/city_battle4.wav", Vol = 150 },
  132. { Sound = "ambient/levels/streetwar/city_battle5.wav", Vol = 150 },
  133. }
  134.  
  135. local BNT = CurTime()
  136. function BlackTea.FireFight()
  137.     if CurTime() > BNT then
  138.         local snd = math.random( 1, #firefight )
  139.        
  140.         LocalPlayer():EmitSound( firefight[snd].Sound , firefight[snd].Vol )
  141.        
  142.             if math.random(1, 10) < 7 then
  143.                 BNT = CurTime() + math.random( 1, 5 )
  144.             else
  145.                 BNT = CurTime() + math.random( 2, 4 )
  146.             end
  147.     end
  148. end
  149.  
  150. local OWS = {
  151.  
  152. { Sound = "npc/overwatch/cityvoice/f_anticitizenreport_spkr.wav", Vol = 150 },
  153. { Sound = "npc/overwatch/cityvoice/f_anticivil1_5_spkr.wav", Vol = 150 },
  154. { Sound = "npc/overwatch/cityvoice/f_anticivilevidence_3_spkr.wav", Vol = 150 },
  155. { Sound = "npc/overwatch/cityvoice/f_capitalmalcompliance_spkr.wav", Vol = 150 },
  156. { Sound = "npc/overwatch/cityvoice/f_sociolevel1_4_spkr.wav", Vol = 150 },
  157. { Sound = "npc/overwatch/cityvoice/f_localunrest_spkr.wav", Vol = 150},
  158. { Sound = "npc/overwatch/cityvoice/f_innactionisconspiracy_spkr.wav", Vol = 150 },
  159. { Sound = "npc/overwatch/cityvoice/f_evasionbehavior_2_spkr.wav", Vol = 150 },
  160.  
  161. }
  162.  
  163. local NOW = 0
  164.  
  165. function BlackTea.OverWatch()
  166.     if CurTime() > NOW then
  167.         local snd = math.random( 1, #OWS )
  168.        
  169.         LocalPlayer():EmitSound( OWS[snd].Sound , OWS[snd].Vol )
  170.        
  171.             if math.random(1, 10) < 7 then
  172.                 NOW = CurTime() + math.random( 15, 25 )
  173.             else
  174.                 NOW = CurTime() + math.random( 15, 35 )
  175.             end
  176.     end
  177. end
Add Comment
Please, Sign In to add comment