Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function GetAmmoForCurrentWeapon( ply )
- if ( !IsValid( ply ) ) then return -1 end
- local wep = ply:GetActiveWeapon()
- if ( !IsValid( wep ) ) then return -1 end
- return ply:GetAmmoCount( wep:GetPrimaryAmmoType() )
- end
- local function DrawZenHud()
- --============================================================================--
- --=== LEWY GÓRNY PASEK HP + ARMOR
- --============================================================================--
- // kordynaty dla lewego górnego huda
- local ZenHudShape1 = {
- { x = 0, y = 0 },
- { x = 180, y = 0 },
- { x = 180, y = 50 },
- { x = 100, y = 100 },
- { x = 0, y = 100 }
- }
- local ZenHudShape1_Padding = 1 + 2 * math.sin(ZenHudAnimTimer - CurTime() / 2)
- local ZenHudShape1_Detail = {
- { x = 0, y = 0 },
- { x = 180 + ZenHudShape1_Padding, y = 0 },
- { x = 180 + ZenHudShape1_Padding, y = 50 + ZenHudShape1_Padding },
- { x = 100 + ZenHudShape1_Padding, y = 100 + ZenHudShape1_Padding },
- { x = 0, y = 100 + ZenHudShape1_Padding }
- }
- local ZenHudBackground = Color(40,40,40,255)
- local ZenHudDetail = Color(40,40,40,128)
- --surface.DrawRect( 0, 0, 128, 128 )
- surface.SetDrawColor( ZenHudDetail )
- // lewa strona u góry - background
- surface.DrawPoly( ZenHudShape1_Detail )
- surface.SetDrawColor( ZenHudBackground )
- // lewa strona u góry
- surface.DrawPoly( ZenHudShape1 )
- // Pasek zdrowia
- local ZenHPPos = 12
- surface.SetDrawColor( 255,255,255,255 )
- surface.SetMaterial( ZenHudHPIcon )
- surface.DrawTexturedRectUV( 12, ZenHPPos, 14, 14, 0, 0, 1, 1 )
- --draw.SimpleText("HP:" , "Trebuchet18", 12, ZenHPPos , Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
- draw.RoundedBox( 4, 35, ZenHPPos, 100, 15, Color( 55, 55, 55, 255 ) )
- draw.RoundedBox( 4, 35, ZenHPPos, math.Clamp( LocalPlayer():Health() , 0 , 100 ) , 15, Color( 255, 255, 255, 255 ) )
- local ZenHPAnimFactor = math.Clamp( LocalPlayer():Health() , 0 , 100 )
- local ZenHPTextAnim = math.sin(ZenHudAnimTimer - CurTime()*(ZenHPAnimFactor-100)/50)
- draw.SimpleText( tostring( LocalPlayer():Health() ) , "Trebuchet18", math.Clamp(12 + ZenHPAnimFactor, 35 , 150 ), ZenHPPos , Color( 255, 60, 50, 255 - 100 * ZenHPTextAnim ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
- // Pasek pancerza
- local ZenArmPos = 42
- surface.SetMaterial( ZenHudArmorIcon )
- surface.DrawTexturedRectUV( 12, ZenArmPos, 14, 14, 0, 0, 1, 1 )
- --draw.SimpleText("Armor:" , "Trebuchet18", 4, ZenArmPos , Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
- draw.RoundedBox( 4, 35, ZenArmPos, 100, 15, Color( 55, 55, 55, 255 ) )
- draw.RoundedBox( 4, 35, ZenArmPos, math.Clamp( LocalPlayer():Armor() , 0 , 100 ) , 15, Color( 255, 255, 255, 255 ) )
- local ZenHPAnimFactor = math.Clamp( LocalPlayer():Armor() , 0 , 100 )
- local ZenHPTextAnim = math.sin(ZenHudAnimTimer - CurTime() * (ZenHPAnimFactor - 100) / 50)
- draw.SimpleText( tostring( LocalPlayer():Armor() ) , "Trebuchet18", math.Clamp(12 + ZenHPAnimFactor, 35 , 150 ), ZenArmPos , Color( 255, 60, 50, 255 - 100 * ZenHPTextAnim ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
- --============================================================================--
- --=== PRAWY GÓRNY PASEK AMUNICJA
- --============================================================================--
- // kordynaty dla lewego górnego huda
- local ZenHudShape2 = {
- { x = ScrW()/2, y = ScrH()/2 },
- { x = ScrW()-180, y = 0 },
- { x = ScrW()-180, y = 50 },
- { x = ScrW()-100, y = 100 },
- { x = ScrW(), y = 100 },
- }
- local ZenHudShape2_Padding = 1 + 2 * math.sin(ZenHudAnimTimer - CurTime() / 2)
- local ZenHudShape2_Detail = {
- { x = ScrW(), y = 0 },
- { x = ScrW()-180 + ZenHudShape2_Padding, y = 0 },
- { x = ScrW()-180 + ZenHudShape2_Padding, y = 50+ZenHudShape2_Padding },
- { x = ScrW()-100 + ZenHudShape2_Padding, y = 100+ZenHudShape2_Padding },
- { x = ScrW(), y = 100 + ZenHudShape2_Padding },
- }
- surface.SetDrawColor( Color(255,255,255,255) )
- --surface.SetDrawColor( ZenHudDetail )
- // Prawa strona u góry - background
- surface.DrawPoly( ZenHudShape2_Detail )
- --surface.SetDrawColor( ZenHudBackground )
- // Prawa strona u góry
- surface.DrawPoly( ZenHudShape2 )
- local PlayerAmmo = GetAmmoForCurrentWeapon( LocalPlayer() )
- if (PlayerAmmo != -1) then
- draw.SimpleText( "Amunicja: "..tostring( PlayerAmmo ) , "Trebuchet18", ScrW() - 100, 20 , Color( 255, 60, 50, 255 - 100 * ZenHPTextAnim ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
- end
- end
- if CLIENT then
- local ZenHudHPIcon = Material( "icon16/heart.png", "noclamp" )
- local ZenHudArmorIcon = Material( "icon16/shield.png", "noclamp" )
- local ZenHudAnimTimer = CurTime()
- // Doczepiamy się do hooka HUDPaint i dodajemy do niego funkcje HUDPaint_ZenHud
- hook.Add( "HUDPaint", "HUDPaint_ZenHud", DrawZenHud() )
- end
- print("ZENHUD ZAŁADOWANY POPRAWNIE - SERVER + CLIENT SIDE")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement