pepsi18 Posted March 12, 2014 Share Posted March 12, 2014 (edited) hi all I was seeing a post and guide me to make a new radar but wanted to know how I could edit the map names to apply also to the radar thanks in advance and excuse my bad English Mapnames -- Settings variables local textFont = "default-bold" -- The font of the tag text local textScale = 1 -- The scale of the tag text local fontHeight = dxGetFontHeight(textScale,textFont) -- The height of the font 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 -- Horizontal distance between the player blip and the tag local yOffset = fontHeight/2 -- Vertical distance between the player blip and the top of the tag local minAlpha = 10 -- If blip alpha falls below this, the tag won't the shown local textAlpha = 255 local rectangleColor = tocolor(0,0,0,230) local function drawMapNames() if exports.maximap:isPlayerMapVisible() then for k,v in ipairs(getElementsByType("blip")) do local attached=getElementAttachedTo(v) if isElement(attached) and getElementType(attached)=="player" then local px,py = getElementPosition(attached) -- Player's position local x,y = exports.maximap:getMapFromWorldPosition(px,py) -- Get the blip position on the map x = x+xOffset -- X for the nametag y = y-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,false) end end end end end addEventHandler("onClientRender",getRootElement(),drawMapNames) radar local screenx, screeny = guiGetScreenSize( ); local posX = 30; local posY = 157; local width = 145; local height = 145; -- local scale = 1.5; local texture = dxCreateTexture( 'radar.dds', 'dxt5', true, 'clamp', '3d' ); imageWidth, imageHeight = dxGetMaterialSize( texture ); showPlayerHudComponent( "radar", false ) local function getCameraRotation () px, py, pz, lx, ly, lz = getCameraMatrix() local rotz = 6.2831853071796 - math.atan2 ( ( lx - px ), ( ly - py ) ) % 6.2831853071796 local rotx = math.atan2 ( lz - pz, getDistanceBetweenPoints2D ( lx, ly, px, py ) ) rotx = math.deg(rotx) rotz = math.deg(rotz) return rotz end function miniradar( ) local px ,py, pz = getElementPosition( localPlayer ) local mapX = px / ( 6000 / imageWidth ) + ( imageWidth / 2 ) - ( width / scale / 2 ); local mapY = py / ( -6000 / imageHeight ) + ( imageHeight / 2 ) - ( height / scale / 2 ); local cx,cy,cz,tx,ty,tz = getCameraMatrix( ); local rotation = getCameraRotation(); dxDrawImageSection( posX, screeny - posY, width, height, mapX, mapY, width / scale, height / scale, texture, rotation, 0, 0, tocolor( 255, 255, 255, 220 ), false ); end addEventHandler("onClientRender",root, miniradar ) Edited March 12, 2014 by Guest Link to comment
Anubhav Posted March 12, 2014 Share Posted March 12, 2014 Whats wrong in this code? Any errors? Link to comment
pepsi18 Posted March 12, 2014 Author Share Posted March 12, 2014 does not have errors but wanted to know if possible edit the script to map names the name tag look at mini radar 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