 
      
    Lua
- 1 ответ
- 0 вопросов
    1
    Вклад в тег
    
      
      
    
  
  
local img_health = vgui.Create('DImage')
img_health:SetImage("//garrysmod/materials/icon16/heart.png")
img_health:SetSize(20,20)
local img_armor = vgui.Create('DImage')
img_armor:SetImage("//garrysmod/materials/icon16/money.png")
img_armor:SetSize(20,20)
local function ShowHud()    
    if ValidPanel(img_health) then
        img_health:SetPos(24,12)
    end
    
    if ValidPanel(img_armor) then
        img_armor:SetPos(325,12)
    end
end
hook.Add("HUDPaint","paintedhud",ShowHud)if ValidPanel(DarkRPHUD_Img_Health) then
    DarkRPHUD_Img_Health:Remove()
    DarkRPHUD_Img_Health = nil
end
if ValidPanel(DarkRPHUD_Img_Armor) then
    DarkRPHUD_Img_Armor:Remove()
    DarkRPHUD_Img_Armor = nil
end
DarkRPHUD_Img_Health = vgui.Create('DImage')
DarkRPHUD_Img_Health:SetImage("//garrysmod/materials/icon16/heart.png")
DarkRPHUD_Img_Health:SetSize(20,20)
DarkRPHUD_Img_Armor = vgui.Create('DImage')
DarkRPHUD_Img_Armor:SetImage("//garrysmod/materials/icon16/money.png")
DarkRPHUD_Img_Armor:SetSize(20,20)
local function ShowHud()    
    if ValidPanel(DarkRPHUD_Img_Health) then
        DarkRPHUD_Img_Health:SetPos(24,12)
    end
    
    if ValidPanel(DarkRPHUD_Img_Armor) then
        DarkRPHUD_Img_Armor:SetPos(325,12)
    end
end
hook.Add("HUDPaint","paintedhud",ShowHud)local img_health = Material( "icon16/heart.png" )
local img_armor = Material( "icon16/money.png" )
local function ShowHud()    
    surface.SetDrawColor( 255, 255, 255 ) -- устанавливается цвет (r, g, b, a)
    surface.SetMaterial( img_health ) -- устанавливается материал, созданный заранее
    surface.DrawTexturedRect( 24, 12, 20, 20 ) -- x, y, width, height
    surface.SetMaterial( img_armor ) -- устанавливается материал, созданный заранее
    surface.DrawTexturedRect( 325, 12, 20, 20 ) -- x, y, width, height
end
hook.Add("HUDPaint","paintedhud",ShowHud)surface.SetMaterial( Material( "icon16/heart.png" ) ) -- тоже возможно, но советуется выносить создание Material в переменную вне хука (согласно вики)surface.CreateFont( "HUD", {
  font = "TargetID",
  extended = false,
  size = 18,
  weight = 600,
})
local img_health = Material( "icon16/heart.png" )
local img_armor = Material( "icon16/money.png" )
local function ShowHud()
    local ply = LocalPlayer()
    local heart = ply:Health()
    local armor = ply:Armor()
    local money = ply:getDarkRPVar("money")
    local salary = ply:getDarkRPVar("salary")
    draw.RoundedBox(0,0,0,2000,45,Color(45,45,45,225))
    draw.DrawText("Здоровья:" .. ' ' .. heart .. '%',"HUD",50,12,Color(255,255,255),0)
    draw.DrawText("Броня:" .. ' ' .. armor .. '%',"HUD",210,12,Color(255,255,255),0)
    draw.DrawText("Деньги:" .. ' ' .. money .. '$',"HUD",355,12,Color(255,255,255),0)
    draw.DrawText("Зарплата:" .. ' ' .. salary .. '$',"HUD",525,12,Color(255,255,255),0)
    surface.SetDrawColor( 255, 255, 255 ) -- устанавливается цвет (r, g, b, a)
    surface.SetMaterial( img_health ) -- устанавливается материал, созданный заранее
    surface.DrawTexturedRect( 24, 12, 20, 20 ) -- x, y, width, height
    surface.SetMaterial( img_armor ) -- устанавливается материал, созданный заранее
    surface.DrawTexturedRect( 325, 12, 20, 20 ) -- x, y, width, height
end
hook.Add("HUDPaint","paintedhud",ShowHud)