Jacobob14 Posted February 4, 2014 Share Posted February 4, 2014 someone help me remove the hex code nick on the map forgive my bad English -- Settings variables local textFont = "default-bold" -- The font of the tag text local textScale = 1 -- The scale of the tag text local heightPadding = 1 -- The amount of pixels the tag should be extended on either side of the vertical axis local widthPadding = 1 -- The amount of pixels the tag should be extended on either side of the horizontal axis local xOffset = 8 -- Distance between the player blip and the tag local minAlpha = 10 -- If blip alpha falls below this, the tag won't the shown local textAlpha = 500 local rectangleColor = tocolor(92,92,92,0) -- Other variables local floor = math.floor local w,h = guiGetScreenSize() local function drawMapStuff() if isPlayerMapVisible() then local sx,sy,ex,ey = getPlayerMapBoundingBox() -- Map positions local mw,mh = ex-sx,sy-ey -- Map width/height local cx,cy = (sx+ex)/2,(sy+ey)/2 -- Center position of the map local ppuX,ppuY = mw/6000,mh/6000 -- Pixels per unit local fontHeight = dxGetFontHeight(textScale,textFont) -- Height of the specified font local yOffset = fontHeight/2 -- How much pixels the tag should be offsetted at local blips = getElementsByType("blip") for k,v in ipairs(blips) do local attached=getElementAttachedTo(v) if isElement(attached) and getElementType(attached)=="player" then local px,py = getElementPosition(attached) -- Player's position local x = floor(cx+px*ppuX+xOffset) -- X for the nametag local y = floor(cy+py*ppuY-yOffset) -- Y for the nametag local pname = getPlayerName(attached) -- Player name local nameLength = dxGetTextWidth(pname,textScale,textFont) -- Width of the playername local r,g,b = getPlayerNametagColor(attached) -- Player's nametag color local _,_,_,a = getBlipColor(v) -- Blip alpha if a>minAlpha then dxDrawRectangle(x-widthPadding,y+heightPadding,nameLength+widthPadding*2,fontHeight-heightPadding*2,rectangleColor,false) dxDrawText(pname,x,y,x+nameLength,y+fontHeight,tocolor(r,g,b,textAlpha),textScale,textFont,"left","top",false,false,true,true) end end end end end addEventHandler("onClientRender",getRootElement(),drawMapStuff) Link to comment
WASSIm. Posted February 4, 2014 Share Posted February 4, 2014 line 35. try this local pname = string.gsub(getPlayerName(attached),"#%x%x%x%x%x%x","") -- Player name Link to comment
Jacobob14 Posted February 4, 2014 Author Share Posted February 4, 2014 line 35. try this local pname = string.gsub(getPlayerName(attached),"#%x%x%x%x%x%x","") -- Player name I do not work I removed the hex code color but this is not all of one color Link to comment
Jacobob14 Posted February 4, 2014 Author Share Posted February 4, 2014 What do you mean? hexadecimal color disappeared but the nick is a single color on the map http://prntscr.com/2pj1n1 Link to comment
DNL291 Posted February 5, 2014 Share Posted February 5, 2014 local textFont = "default-bold" local textScale = 1 local heightPadding = 1 local widthPadding = 1 local xOffset = 8 local minAlpha = 10 local textAlpha = 255 local rectangleColor = tocolor(0,0,0,145) local floor = math.floor local w,h = guiGetScreenSize() local function drawMapStuff() if isPlayerMapVisible() then local sx,sy,ex,ey = getPlayerMapBoundingBox() local mw,mh = ex-sx,sy-ey local cx,cy = (sx+ex)/2,(sy+ey)/2 local ppuX,ppuY = mw/6000,mh/6000 local fontHeight = dxGetFontHeight(textScale,textFont) local yOffset = fontHeight/2 local blips = getElementsByType("blip") for k,v in ipairs(blips) do local attached=getElementAttachedTo(v) if isElement(attached) and getElementType(attached)=="player" then local px,py = getElementPosition(attached) local x = floor(cx+px*ppuX+xOffset) local y = floor(cy+py*ppuY-yOffset) local pname = getPlayerName(attached) local pname2 = getPlayerName(attached):gsub("#%x%x%x%x%x%x", "") local nameLength = dxGetTextWidth(pname2,textScale,textFont) local r,g,b = getPlayerNametagColor(attached) local _,_,_,a = getBlipColor(v) if a>minAlpha then dxDrawRectangle(x-widthPadding,y+heightPadding,nameLength+widthPadding*2,fontHeight-heightPadding*1,rectangleColor,false) dxDrawText(pname2,x+1,y+1,x+nameLength,y+fontHeight,tocolor(0,0,0,255),textScale,textFont,"left","top",false,false,false,true) dxDrawText(pname,x,y,x+nameLength,y+fontHeight,tocolor(r,g,b),textScale,textFont,"left","top",false,false,false,true) end end end end end addEventHandler("onClientRender",getRootElement(),drawMapStuff) Is that what do you meant? Link to comment
Jacobob14 Posted February 5, 2014 Author Share Posted February 5, 2014 local textFont = "default-bold" local textScale = 1 local heightPadding = 1 local widthPadding = 1 local xOffset = 8 local minAlpha = 10 local textAlpha = 255 local rectangleColor = tocolor(0,0,0,145) local floor = math.floor local w,h = guiGetScreenSize() local function drawMapStuff() if isPlayerMapVisible() then local sx,sy,ex,ey = getPlayerMapBoundingBox() local mw,mh = ex-sx,sy-ey local cx,cy = (sx+ex)/2,(sy+ey)/2 local ppuX,ppuY = mw/6000,mh/6000 local fontHeight = dxGetFontHeight(textScale,textFont) local yOffset = fontHeight/2 local blips = getElementsByType("blip") for k,v in ipairs(blips) do local attached=getElementAttachedTo(v) if isElement(attached) and getElementType(attached)=="player" then local px,py = getElementPosition(attached) local x = floor(cx+px*ppuX+xOffset) local y = floor(cy+py*ppuY-yOffset) local pname = getPlayerName(attached) local pname2 = getPlayerName(attached):gsub("#%x%x%x%x%x%x", "") local nameLength = dxGetTextWidth(pname2,textScale,textFont) local r,g,b = getPlayerNametagColor(attached) local _,_,_,a = getBlipColor(v) if a>minAlpha then dxDrawRectangle(x-widthPadding,y+heightPadding,nameLength+widthPadding*2,fontHeight-heightPadding*1,rectangleColor,false) dxDrawText(pname2,x+1,y+1,x+nameLength,y+fontHeight,tocolor(0,0,0,255),textScale,textFont,"left","top",false,false,false,true) dxDrawText(pname,x,y,x+nameLength,y+fontHeight,tocolor(r,g,b),textScale,textFont,"left","top",false,false,false,true) end end end end end addEventHandler("onClientRender",getRootElement(),drawMapStuff) Is that what do you meant? Thanks now if I work well 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