Jacobob14 Posted March 7, 2014 Share Posted March 7, 2014 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
Castillo Posted March 7, 2014 Share Posted March 7, 2014 What's the problem? try using tostring ( lvl ) at dxDrawText. Link to comment
Jacobob14 Posted March 7, 2014 Author Share Posted March 7, 2014 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
WASSIm. Posted March 7, 2014 Share Posted March 7, 2014 change 5 to this local lvl = tostring(getElementData(getLocalPlayer(),"level")) Link to comment
pa3ck Posted March 7, 2014 Share Posted March 7, 2014 Of course, because getElementData(localPlayer() ...) returns your element data, not the other players'. Link to comment
Saml1er Posted March 7, 2014 Share Posted March 7, 2014 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. Link to comment
Ab-47 Posted March 7, 2014 Share Posted March 7, 2014 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
Moderators Citizen Posted March 7, 2014 Moderators Share Posted March 7, 2014 Well didn't see the right answer here so here it is: local lvl = tostring( getElementData( player, "level" ) ) Link to comment
Saml1er Posted March 7, 2014 Share Posted March 7, 2014 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 Link to comment
Jacobob14 Posted March 7, 2014 Author Share Posted March 7, 2014 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
Karuzo Posted March 7, 2014 Share Posted March 7, 2014 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
Jacobob14 Posted March 7, 2014 Author Share Posted March 7, 2014 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
Jacobob14 Posted March 7, 2014 Author Share Posted March 7, 2014 getPlayerTeam getTeamColor thanks solid and thank you all served me well your help: D Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now