• Basic Level Bar Problems
    0 replies, posted
Hey guys I am having trouble with getting the width of the bar inside of the outlined bar in my level bar hud. For some reason the bar won't appear and I can't figure out what I am doing wrong. If anyone can point me in the right direction, much would be appreciated. local barpos = 1 local x,y,w,h local curLvlXP = (500 * 4 * lvl + (lvl - 1) * 500) local xprequired = 0 if LocalPlayer():getChar() then xprequired = math.Clamp((xp - curLvlXP) / ((500 * 4 * (lvl + 1) + lvl * 500) - curLvlXP), 0, .9) if barpos == 0 then x,y,w,h = 10,40,ScrW()-20,20 elseif barpos == 1 then x,y,w,h = 35,ScrH()-120,200,20  end if LocalPlayer():Alive() then surface.SetDrawColor(0,0,0,255) surface.DrawOutlinedRect(x,y,w,h) surface.SetDrawColor(200,0,0,255) surface.DrawRect(x+1.2,y+1.2,w*((xp)/(xprequired))-2,h-2) draw.DrawText("Level " .. lvl,"BudgetLabel",x+w/2,y-20,Color(255,255,255,255),1) draw.DrawText(xp .. "/" .. xprequired,"BudgetLabel",x+w/2,y+1,Color(0,0,0,255),1) end
Sorry, you need to Log In to post a reply to this thread.