• Need help, bad at hud coding.
    1 replies, posted
Can anyone here add a simple part of the hud to this script: [code]local NUM_BOXES = 8 local BOX_WIDTH = 40 local BOX_TOTAL_HEIGHT = 120 surface.CreateFont( "coolvecta", 76, 500, true, false, "Speedo" ) local RPMGauge = 0 hook.Add("HUDPaint", "DrawRPMSpeed", function() if !IsValid(LocalPlayer()) || !LocalPlayer():InVehicle() then return end local vehicle = LocalPlayer():GetVehicle() RPMGauge = math.Approach(RPMGauge, vehicle:GetPoseParameter("vehicle_guage"), FrameTime() * 2) local rpm = RPMGauge local speed = vehicle:GetVelocity():Length() * (15/352) // speedometer: local x, y = 40, ScrH() - 80 local w, h = 250, 70 draw.RoundedBox(16, x, y, w, h, Color(200, 200, 200, 100)) draw.SimpleTextOutlined(tostring(math.Round(speed)) .. " MPH", "Speedo", x + w/2, y + h/2, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 2, Color(0, 0, 0, 100)) // RPM gauge: local xwidth = NUM_BOXES * BOX_WIDTH local yheight = BOX_TOTAL_HEIGHT local frac = rpm * xwidth local x, y = ScrW() - BOX_WIDTH - 10, ScrH() - yheight - 10 for i=NUM_BOXES, 1, -1 do if frac > xwidth - BOX_WIDTH then surface.SetDrawColor(Color(math.min(i+5, NUM_BOXES) * (255 / NUM_BOXES), (NUM_BOXES-i) * (255 / NUM_BOXES), 0, 255)) surface.DrawRect(x, y, math.min(frac - xwidth, BOX_WIDTH), yheight) end surface.SetDrawColor(Color(0, 0, 0, 100)) surface.DrawOutlinedRect(x, y, BOX_WIDTH, yheight) xwidth = xwidth - BOX_WIDTH x = x - BOX_WIDTH - 3 y = y + xwidth * 0.07 yheight = yheight - xwidth * 0.07 end end) local tohide = {"CHudSuitPower", "CHudHealth", "CHudBattery", "CHudAmmo", "CHudSecondaryAmmo", "CHudCrosshair"} hook.Add("HUDShouldDraw", "HideHud", function(hud) if table.HasValue(tohide, hud) then return false end end)[/code] that shows the NWInt 'money' (basically shows how much money you have. thank you)
Do you pay?
Sorry, you need to Log In to post a reply to this thread.