Jump to content

help nametag


Recommended Posts

as I can do to make the player level look

not my level : (

local lvl = (getElementData(getLocalPlayer(),"level")) 
                     dxDrawText ( "nivel: "..lvl, sx- 20, sy - 25, sx -20, sy - 25, tocolor(255,100,0,255), 1, srfont, "center", "bottom", false, false, false ) 
                 

Link to comment

when I see the tag Player

my level appears

and not the level of player

local r,g,b = getPlayerNametagColor(player) 
                    local offset = (scale) * NAMETAG_TEXT_BAR_SPACE/2 
                    local offset2 = ((scale) * NAMETAG_TEXT_BAR_SPACE/2) - 35 
                     local w = dxGetTextWidth(getPlayerNameR(player), textscale * NAMETAG_TEXTSIZE, srfont) / 2 
                     local lvl = (getElementData(getLocalPlayer(),"level")) 
                    dxDrawText ( "#FF6400Nivel: "..lvl.."            \n#000000"..getPlayerNameR(player), sx, sy - offset, sx, sy - offset, tocolor(0,0,0,255), textscale*NAMETAG_TEXTSIZE, srfont, "center", "bottom", false,false,false,true,false ) 
                    dxDrawColorText ( getPlayerName(player), sx-w, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), textscale*NAMETAG_TEXTSIZE, srfont, "center", "bottom", false, false, false ) 

Link to comment
local lvl = getElementData ( getPlayerFromName ( player ), "level" ) or "Can't find Player" 
  

Replace it with this and don't use dxDrawColor text because its dxDrawText supports hex code.

Afaik, you'll get a debug error saying something like expected error at argument 1 (a nil value). Or maybe if player is defined, then.. Just try WASSim's way or Solidsnake's..

Link to comment

I did it this way

will be fine?

local lvl = getElementData(player, "level") 
                    dxDrawText ( "#FF6400Nivel: ".. tostring(lvl)..\n#000000"..getPlayerNameR(player), sx, sy - offset, sx, sy - offset, tocolor(0,0,0,255), textscale*NAMETAG_TEXTSIZE, srfont, "center", "bottom", false,false,false,true,false ) 
 

Link to comment

No

  
    local lvl = getElementData(player, "level") 
                        dxDrawText ( "#FF6400Nivel: ".. tostring(lvl).."\n#000000"..getPlayerNameR(player), sx, sy - offset, sx, sy - offset, tocolor(0,0,0,255), textscale*NAMETAG_TEXTSIZE, srfont, "center", "bottom", false,false,false,true,false ) 
  

Link to comment

thanks I did not realize the error

No
  
    local lvl = getElementData(player, "level") 
                        dxDrawText ( "#FF6400Nivel: ".. tostring(lvl).."\n#000000"..getPlayerNameR(player), sx, sy - offset, sx, sy - offset, tocolor(0,0,0,255), textscale*NAMETAG_TEXTSIZE, srfont, "center", "bottom", false,false,false,true,false ) 
  

if not much bother as I can make

color rectangle of team

local health 
                    local p 
                    local a,g 
                    health = getElementHealth ( player ) 
                    health = math.max(health, 0)/100 
                    p = -510*(health^2) 
                    r,g = math.max(math.min(p + 255*health + 255, 255), 0), math.max(math.min(p + 765*health, 255), 0) 
                    if health > 1.0 then 
                        health = 1.0 
                    end 
                    dxDrawRectangle (   drawX + outlineThickness, 
                                        drawY + outlineThickness, 
                                        width - outlineThickness*2, 
                                        height - outlineThickness*2, 
                                        tocolor(0,0,0,50) 
                                    ) 
                    --Finally, the actual health 
                    dxDrawRectangle (   drawX + outlineThickness, 
                                        drawY + outlineThickness, 
                                        health*(width - outlineThickness*2), 
                                        height - outlineThickness*2, 
                                        tocolor(r,g,b) 
                                    )  
                         

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...