• Need help from hud
    2 replies, posted
surface.CreateFont("hud_default", { size = 21, weight = 350, antialias = true, extended = true, font = "Roboto"}) surface.CreateFont("HUD_time", { size = 30, weight = 350, antialias = true, extended = true, font = "Roboto"}) hook.Add("HUDPaint" , "Draw" , function()  local money = LocalPlayer():getDarkRPVar("money") or 0   -------------------------------------------------------------------------------------   draw.SimpleTextOutlined(LocalPlayer():getDarkRPVar("job") or "", "hud_default", 110, ScrH() - 85, team.GetColor(LocalPlayer():Team()), 0, 0, 1, Color( 0, 0, 0, 255 ) )   draw.SimpleTextOutlined("Профессия:", "hud_default", 7, ScrH() - 85, Color(255,255,255), 0, 0, 1, Color( 0, 0, 0, 255 ) ) ------------------------------------------------------------------------------------------------------ --  draw.SimpleTextOutlined(LocalPlayer():GetEyeTrace().HitTexture, "hud_default", 133, ScrH() - 444, Color(255, 255, 255, 255), 0, 0, 1, Color( 0, 0, 0, 255 ) )  draw.SimpleTextOutlined("Кошелёк:", "hud_default", 7, ScrH() - 55, Color(255,255,255), 0, 0, 1, Color( 0, 0, 0, 255 ) )   draw.SimpleTextOutlined(LocalPlayer():getDarkRPVar("money")..'$ + '..LocalPlayer():getDarkRPVar("salary").."$", "hud_default", 88, ScrH() - 55, Color(255, 191, 0, 255), 0, 0, 1, Color( 0, 0, 0, 255 ) )      local health = LocalPlayer():Health() or 0      local armor = LocalPlayer():Armor() or 0      local health1 = LocalPlayer():Health() or 9999      local armor1 = LocalPlayer():Armor() or 255      local ply = LocalPlayer()     local health = math.Clamp(ply:Health(), 0, 100)  -- draw.RoundedBox(0,105,ScrH() - 24,159+4 , 15 + 4,Color(0,0,0,200))   draw.RoundedBox(0,107,ScrH() - 24,health * 1.4,17,Color(255,0,0,95))   draw.SimpleTextOutlined("Здоровье :", "hud_default", 9, ScrH() - 27, Color(255,255,255), 0, 0, 1, Color( 0, 0, 0, 255 ) )   draw.SimpleTextOutlined( os.date("%H:%M:%S"), "HUD_time", 7, ScrH() - 120, Color(255,255,255), 0, 0, 1, Color( 0, 0, 0, 255 ) )   draw.SimpleTextOutlined(math.ceil(health1), "hud_default", 158, ScrH() - 26, Color(255,255,255), 0, 0, 1, Color( 0, 0, 0, 255 ) )   local x, y = ScrW() / 2, ScrH() / 2   local w, h = 100, 100   surface.SetDrawColor( Color( 0, 0, 0 ) ) -- set the outline's color   surface.DrawOutlinedRect( 105,ScrH () - 24, 143, 18) -- draw the outline   local armor = math.Clamp(ply:Armor(), 0, 100) --  draw.RoundedBox(0,350,ScrH() - 24,159+4 , 15 + 4,Color(0,0,0,200))   draw.RoundedBox(0,325,ScrH() - 23,armor * 1.4,17,Color(0,63,255,89))   draw.SimpleTextOutlined(math.ceil(armor1).."", "hud_default", 388, ScrH() - 26, Color(255,255,255), 0, 0, 1, Color( 0, 0, 0, 255 ) )   draw.SimpleTextOutlined("Броня :", "hud_default", 255, ScrH() - 27, Color(255,255,255), 0, 0, 1, Color( 0, 0, 0, 255 ) )   local x, y = ScrW() / 2, ScrH() / 2   local w, h = 100, 100   surface.SetDrawColor( Color(0, 0, 0 ) ) -- set the outline's color   surface.DrawOutlinedRect( 323,ScrH() - 24, 143, 18) -- draw the outline end) /*--------------------------------------------------------------------------- Display notifications ---------------------------------------------------------------------------*/ local function DisplayNotify(msg)     local txt = msg:ReadString()     GAMEMODE:AddNotify(txt, msg:ReadShort(), msg:ReadLong())     surface.PlaySound("buttons/lightswitch2.wav")     -- Log to client console     MsgC(Color(255, 20, 20, 255), "[DarkRP] ", Color(200, 200, 200, 255), txt, "\n") end usermessage.Hook("_Notify", DisplayNotify) local VoiceChatTexture = surface.GetTextureID( "voice/icntlk_pl" ) local function DrawVoiceChat() if LocalPlayer().DRPIsTalking then local chbxX, chboxY = chat.GetChatBoxPos() local Rotating = math.sin(CurTime()*3) local backwards = 0 if Rotating < 0 then Rotating = 1-(1+Rotating) backwards = 180 end surface.SetTexture( VoiceChatTexture ) surface.SetDrawColor( 140, 0, 0, 180 ) surface.DrawTexturedRectRotated( ScrW() - 100, chboxY, Rotating*96, 96, backwards ) end end --------------------------------------------------------------------------- -- HUD holord HUD -- --------------------------------------------------------------------------- function holord() if not LocalPlayer():Alive() then return end DrawVoiceChat() end hook.Add("HUDPaint", "DarkRP_Mod_HUDPaint", holord) function GAMEMODE:HUDShouldDraw(name) if name == "CHudHealth" or name == "CHudBattery" or name == "CHudSuitPower" or (HelpToggled and name == "CHudChat") then return false else return true end end Very much eats the client part of the thin, help fix Imgur
It's most likely from the trace you're firing to get the HitTexture - the overhead from that is unavoidable, so either optimise around it or remove that part of the HUD.
Sorry, you need to Log In to post a reply to this thread.