Hello Ulysses Community, well i'm a little bit confused, when i join my server i start with values:
Level: 1
Exp: 1
Free Points: 0
IF I Level Up all the values update and i get the real ones ( my real level, my real exp and my real free points ).
Here is my lua code but i can't handle out the problem, if someone can help me i'm going to be really happy
local function qHUDBase()
if( LocalPlayer():GetActiveWeapon() == "Camera" ) then return end
//Variables
local pl = LocalPlayer()
local bgcolor = Color( 255, 255, 255, 100 )
local speed = 0
local health = pl:Health()
local armor = pl:Armor()
LocalPlayer().DarkRPVars = LocalPlayer().DarkRPVars or {}
LocalPlayer().DarkRPVars.Energy = LocalPlayer().DarkRPVars.Energy or 0
surface.SetFont( "TabLarge" )
draw.RoundedBox(0, ScrW() * 0, ScrH() * 0 , 2000, 32, bgcolor, 1)
if( !LocalPlayer():Alive() ) then return end
if( LocalPlayer():GetActiveWeapon() == NULL ) then return end
if( LocalPlayer():Alive() ) then
//Health
draw.RoundedBox( 0, 100, 9, 150, 18, Color( 125, 125, 125, 180 ) )
draw.RoundedBox( 0, 100, 9, math.Clamp( health, 0, 100 ) * 1.50, 18, Color( 195, 0, 0, 180 ) )
surface.SetDrawColor( Color( 65, 65, 65, 180 ) )
surface.DrawOutlinedRect( 100, 9, 150, 18 )
draw.SimpleText( "Health: "..health, "TabLarge", 100 + 150 / 2 - surface.GetTextSize( "Health: "..health ) / 2, 11, Color( 255, 255, 255, 255 ), 0, 0 )
//Armor
draw.RoundedBox( 0, 280, 9, 150, 18, Color( 125, 125, 125, 180 ) )
draw.RoundedBox( 0, 280, 9, math.Clamp( armor, 0, 100 ) * 1.50, 18, Color( 255, 165, 0, 180 ) )
surface.SetDrawColor( Color( 65, 65, 65, 180 ) )
surface.DrawOutlinedRect( 280, 9, 150, 18 )
draw.SimpleText( "Armor: "..armor, "TabLarge", 280 + 150 / 2 - surface.GetTextSize( "Armor: "..armor ) / 2, 11, Color( 255, 255, 255, 255 ), 0, 0 )
//Rank
draw.RoundedBox( 0, 1180, 9, 150, 18, Color( 125, 125, 125, 180 ) )
surface.SetDrawColor( Color( 65, 65, 65, 180 ) )
surface.DrawOutlinedRect( 1180, 9, 150, 18 )
draw.SimpleText( "Account: ", "TabLarge", 1180 + 150 / 2 - surface.GetTextSize( "Account: Super Admin" ) / 2, 11, Color( 255, 255, 255, 255 ), 0, 0 )
if pl:IsSuperAdmin() or pl:IsAdmin() or pl:IsUserGroup("mod") then
draw.SimpleText( "Staff Member ", "TabLarge", 1235 + 150 / 2 - surface.GetTextSize( "Account: Super Admin" ) / 2, 11, Color( 127, 255, 159, 255 ), 0, 0 )
else
if pl:IsUserGroup("premium") then
draw.SimpleText( "Premium ", "TabLarge", 1235 + 150 / 2 - surface.GetTextSize( "Account: Super Admin" ) / 2, 11, Color( 255, 223, 127, 255 ), 0, 0 )
else
if pl:IsUserGroup("user") then
draw.SimpleText( "Normal ", "TabLarge", 1235 + 150 / 2 - surface.GetTextSize( "Account: Super Admin" ) / 2, 11, Color( 0, 0, 0, 255 ), 0, 0 )
end
end
end
if !pl:Alive() then return end
if(pl:GetActiveWeapon() == "Camera") then return end
if(pl.RP_SQL == nil) then pl.RP_SQL = {}; end;
//Level
draw.RoundedBox( 0, 640, 9, 150, 18, Color( 125, 125, 125, 180 ) )
surface.SetDrawColor( Color( 65, 65, 65, 180 ) )
surface.DrawOutlinedRect( 640, 9, 150, 18 )
local strDisplay = "1" or pl.RP_SQL["StrengthLvl"];
local strXP = pl.RP_SQL["StrengthExp"] or "0";
draw.SimpleText( "Level: "..strDisplay , "TabLarge", 590 + 150 / 2 + surface.GetTextSize( "Level: ".. strXP ) / 2, 11, Color( 255, 255, 255, 255 ), 0, 0 )
//Exp
draw.RoundedBox( 0, 820, 9, 150, 18, Color( 125, 125, 125, 180 ) )
surface.SetDrawColor( Color( 65, 65, 65, 180 ) )
surface.DrawOutlinedRect( 820, 9, 150, 18 )
draw.SimpleText( "Req Exp: ".. tonumber(strDisplay) * 10 - tonumber(strXP) , "TabLarge", 750 + 150 / 2 + surface.GetTextSize( "Req Exp: ".. tonumber(strDisplay) * 10 - tonumber(strXP) ) / 2, 11, Color( 255, 255, 255, 255 ), 0, 0 )
//Points
draw.RoundedBox( 0, 1000, 9, 150, 18, Color( 125, 125, 125, 180 ) )
surface.SetDrawColor( Color( 65, 65, 65, 180 ) )
surface.DrawOutlinedRect( 1000, 9, 150, 18 )
local agilXP = pl.RP_SQL["AgilityExp"] or "0";
draw.SimpleText( "Free Points: "..agilXP , "TabLarge", 930 + 150 / 2 + surface.GetTextSize( "Free Points: "..agilXP) / 2 , 11, Color( 255, 255, 255, 255 ), 0, 0 )
end
end
hook.Add( "HUDPaint", "qHUDBase", qHUDBase )
http://pastebin.com/qjSXS2rVThanks.