Jump to content

help nametag


Recommended Posts

Posted

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 ) 
                 

Posted

What's the problem? try using tostring ( lvl ) at dxDrawText.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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 ) 

Posted
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.

Posted
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..

And now Aurora is back again, pm for more info.

Ex. Lead dev & L6 Staff at AUR, NGC, MTA RP & SAA.

Ex. Developer at Community of Social Gamers - CSG

Ex Founder of International Gaming Community - IGC and Union of Individual Players- UIP

9o6E8.png Ab-47

  • Moderators
Posted

Well didn't see the right answer here so here it is:

local lvl = tostring( getElementData( player, "level" ) ) 

The rEvolution is coming ...

Posted
Well didn't see the right answer here so here it is:
local lvl = tostring( getElementData( player, "level" ) ) 

Yes, thats it. No wonder why I wrote getPlayerFromName there :o

Posted

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 ) 
 

Posted

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 ) 
  

Posted

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) 
                                    )  
                         

Posted
getPlayerTeam 
getTeamColor 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...