SpoC^ Posted May 3, 2015 Share Posted May 3, 2015 (edited) Hello friends, I developed the radar style GTA V, I want placing map's edges GPS, equal to GTA V, transparency at the edges, someone dares to help? .lua dxSetBlendMode("blend") dxSetRenderTarget() dxDrawImageSection(RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, rtSX/2-RADAR_SX/2, rtSY/2-RADAR_SY/2, RADAR_SX, RADAR_SY, radarRT1, 0, 0, 0, tocolor(255, 255, 255, 11)) MTA:SA - My work GTA V - My intention Edited May 5, 2015 by Guest Link to comment
3B00DG4MER Posted May 4, 2015 Share Posted May 4, 2015 Use Mask shader, https://forum.multitheftauto.com/viewtopic.php?f=108&t=71470 No photoshop skills needed I've already make one with 3D rotation.. I've some problems while trying to put on localPlayer Blip viewtopic.php?f=91&t=87549 Link to comment
GTX Posted May 4, 2015 Share Posted May 4, 2015 Easier way: dxSetTextureEdge(renderTarget, "border", tocolor(255, 255, 255, 100)) Link to comment
#RooTs Posted May 5, 2015 Share Posted May 5, 2015 Easier way: dxSetTextureEdge(renderTarget, "border", tocolor(255, 255, 255, 100)) show me examples. friend please Link to comment
Blaawee Posted May 5, 2015 Share Posted May 5, 2015 From the wiki. local renderTarget1 = dxCreateScreenSource(300, 300) dxSetTextureEdge(renderTarget1, "wrap") local renderTarget2 = dxCreateScreenSource(300, 300) dxSetTextureEdge(renderTarget2, "mirror") local renderTarget3 = dxCreateScreenSource(300, 300) dxSetTextureEdge(renderTarget3, "clamp") local renderTarget4 = dxCreateScreenSource(300, 300) dxSetTextureEdge(renderTarget4, "border", tocolor(255, 0, 0)) addEventHandler("onClientRender", root, function() -- Update the screen sources dxUpdateScreenSource(renderTarget1) dxUpdateScreenSource(renderTarget2) dxUpdateScreenSource(renderTarget3) dxUpdateScreenSource(renderTarget4) -- Draw screen sources in different modes dxDrawImageSection(20, 200, 300, 300, -50, 0, 100, 100, renderTarget1) dxDrawImageSection(350, 200, 300, 300, -50, 0, 100, 100, renderTarget2) dxDrawImageSection(680, 200, 300, 300, -50, 0, 100, 100, renderTarget3) dxDrawImageSection(1010, 200, 300, 300, -50, 0, 100, 100, renderTarget4) end ) Link to comment
John Smith Posted May 5, 2015 Share Posted May 5, 2015 I need Help, friends If you've 'developed' a functional GTA V Radar with blips and radar areas, then you shouldn't have problems to use such an easy function like this one is. Link to comment
SpoC^ Posted May 5, 2015 Author Share Posted May 5, 2015 I need Help, friends If you've 'developed' a functional GTA V Radar with blips and radar areas, then you shouldn't have problems to use such an easy function like this one is. You are diverting the focus of my topic. "get help" Link to comment
Walid Posted May 5, 2015 Share Posted May 5, 2015 (edited) As i can see you need to to create a border with lines right so try to use this and tell me the result: function dxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end Edited May 5, 2015 by Guest Link to comment
SpoC^ Posted May 5, 2015 Author Share Posted May 5, 2015 this is the map code dxSetBlendMode("blend") dxSetRenderTarget() dxDrawImageSection(RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, rtSX/2-RADAR_SX/2, rtSY/2-RADAR_SY/2, RADAR_SX, RADAR_SY, radarRT1, 0, 0, 0, tocolor(255, 255, 255, 11)) Link to comment
Walid Posted May 5, 2015 Share Posted May 5, 2015 try this : -- Your code dxSetBlendMode("blend") dxSetRenderTarget() dxDrawImageSection(RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, rtSX/2-RADAR_SX/2, rtSY/2-RADAR_SY/2, RADAR_SX, RADAR_SY, radarRT1, 0, 0, 0, tocolor(255, 255, 255, 11)) dxDrawImageBorder (RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, tocolor(0,0,0,255) ,2,false) -- My code function dxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end Link to comment
SpoC^ Posted May 5, 2015 Author Share Posted May 5, 2015 As i can see you need to to create a border with lines right so try to use this and tell me the result: function DxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end No did get any results Link to comment
Walid Posted May 5, 2015 Share Posted May 5, 2015 No did get any results it's dxDrawImageBorder() not DxDrawImageBorder() copy and past my code Link to comment
SpoC^ Posted May 5, 2015 Author Share Posted May 5, 2015 try this : -- Your code dxSetBlendMode("blend") dxSetRenderTarget() dxDrawImageSection(RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, rtSX/2-RADAR_SX/2, rtSY/2-RADAR_SY/2, RADAR_SX, RADAR_SY, radarRT1, 0, 0, 0, tocolor(255, 255, 255, 11)) dxDrawImageBorder (RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, tocolor(0,0,0,255) ,2,false) -- My code function dxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end This was the result Link to comment
Walid Posted May 5, 2015 Share Posted May 5, 2015 post full code here i'm pretty sure you did something wrong Link to comment
SpoC^ Posted May 5, 2015 Author Share Posted May 5, 2015 (edited) post full code here i'm pretty sure you did something wrong function renderRadar() if not radarRT1 and radarRT2 then return end dxDrawImage(70*sW, 697*sH, 236*sW, 9*sH, "sz/blips/radarbg.png", 0, 0, 0, tocolor(0, 0, 0, RBACK_ALPHA)) local aPercent = math.abs(getTickCount()%1000 - 500) / 500 for k, Rarea in ipairs( getElementsByType("radararea") ) do if isElementVisible(Rarea) then local r, g, b, a = getRadarAreaColor(Rarea) local x, y, _ = getElementPosition(Rarea) local sx, sy = getRadarAreaSize(Rarea) local rx, ry = getImagePointFromWorld(x, y) local rsx, rsy = sx * MAP_MPP, -sy * MAP_MPP if isRadarAreaFlashing(Rarea) then a = a * aPercent end dxDrawRectangle(rx-uvX, ry-uvY, rsx, rsy, tocolor(r, g, b, a)) end end dxSetRenderTarget(radarRT1, true) dxDrawImage(0, 0, rtSX, rtSY, radarRT2, crot) -- Your code dxSetBlendMode("blend") dxSetRenderTarget() dxDrawImageSection(RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, rtSX/2-RADAR_SX/2, rtSY/2-RADAR_SY/2, RADAR_SX, RADAR_SY, radarRT1, 0, 0, 0, tocolor(255, 255, 255, 11)) dxDrawImageBorder (RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, tocolor(0,0,0,255) ,2,false) -- My code function dxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end Edited May 6, 2015 by Guest Link to comment
Walid Posted May 5, 2015 Share Posted May 5, 2015 many things wrong sorry i can't fix them all now anyways try this one function renderRadar() if not radarRT1 and radarRT2 then return end dxDrawImage(70*sW, 697*sH, 236*sW, 9*sH, "sz/blips/radarbg.png", 0, 0, 0, tocolor(0, 0, 0, RBACK_ALPHA)) dxDrawImageBorder (70*sW, 697*sH, 236*sW, 9*sH, tocolor(0,0,0,255) ,2,false) local px, py, pz = getElementPosition(localPlayer) local _, _, crot = getElementRotation(getCamera()) if getElementInterior(localPlayer) == 0 then local mpx, mpy = getImagePointFromWorld(px, py) local rtSX, rtSY = dxGetMaterialSize(radarRT1) local uvX, uvY = mpx-(rtSX/2), mpy-(rtSY/2) local uvSX, uvSY = rtSX, rtSY dxSetRenderTarget(radarRT2, true) dxSetBlendMode("modulate_add") local aPercent = math.abs(getTickCount()%1000 - 500) / 500 for k, Rarea in ipairs( getElementsByType("radararea") ) do if isElementVisible(Rarea) then local r, g, b, a = getRadarAreaColor(Rarea) local x, y, _ = getElementPosition(Rarea) local sx, sy = getRadarAreaSize(Rarea) local rx, ry = getImagePointFromWorld(x, y) local rsx, rsy = sx * MAP_MPP, -sy * MAP_MPP if isRadarAreaFlashing(Rarea) then a = a * aPercent end dxDrawRectangle(rx-uvX, ry-uvY, rsx, rsy, tocolor(r, g, b, a)) end end dxSetRenderTarget(radarRT1, true) dxDrawImage(0, 0, rtSX, rtSY, radarRT2, crot) dxSetBlendMode("blend") dxDrawImageSection(RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, rtSX/2-RADAR_SX/2, rtSY/2-RADAR_SY/2, RADAR_SX, RADAR_SY, radarRT1, 0, 0, 0, tocolor(255, 255, 255, 11)) dxDrawImageBorder (RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, tocolor(0,0,0,255) ,2,false) end end addEventHandler ( "onClientRender", root, renderRadar ) -- My code function dxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end Link to comment
SpoC^ Posted May 5, 2015 Author Share Posted May 5, 2015 (edited) many things wrong sorry i can't fix them all now anyways try this one function renderRadar() if not radarRT1 and radarRT2 then return end dxDrawImage(70*sW, 697*sH, 236*sW, 9*sH, "sz/blips/radarbg.png", 0, 0, 0, tocolor(0, 0, 0, RBACK_ALPHA)) dxDrawImageBorder (70*sW, 697*sH, 236*sW, 9*sH, tocolor(0,0,0,255) ,2,false) local aPercent = math.abs(getTickCount()%1000 - 500) / 500 for k, Rarea in ipairs( getElementsByType("radararea") ) do if isElementVisible(Rarea) then local r, g, b, a = getRadarAreaColor(Rarea) local x, y, _ = getElementPosition(Rarea) local sx, sy = getRadarAreaSize(Rarea) local rx, ry = getImagePointFromWorld(x, y) local rsx, rsy = sx * MAP_MPP, -sy * MAP_MPP if isRadarAreaFlashing(Rarea) then a = a * aPercent end dxDrawRectangle(rx-uvX, ry-uvY, rsx, rsy, tocolor(r, g, b, a)) end end dxSetRenderTarget(radarRT1, true) dxDrawImage(0, 0, rtSX, rtSY, radarRT2, crot) dxSetBlendMode("blend") dxDrawImageSection(RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, rtSX/2-RADAR_SX/2, rtSY/2-RADAR_SY/2, RADAR_SX, RADAR_SY, radarRT1, 0, 0, 0, tocolor(255, 255, 255, 11)) dxDrawImageBorder (RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, tocolor(0,0,0,255) ,2,false) end end addEventHandler ( "onClientRender", root, renderRadar ) -- My code function dxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end Not Work Edited May 6, 2015 by Guest Link to comment
SpoC^ Posted May 5, 2015 Author Share Posted May 5, 2015 (edited) Look complete function function renderRadar() if not radarRT1 and radarRT2 then return end dxDrawImage(70*sW, 697*sH, 236*sW, 9*sH, "sz/blips/radarbg.png", 0, 0, 0, tocolor(0, 0, 0, RBACK_ALPHA)) ---------------------------------------------------------------------------- local vehicle = getPedOccupiedVehicle (localPlayer) if isPedInVehicle(localPlayer) then local vx,vy,vz = getElementVelocity(vehicle) velocidade = ( 1 + (vx^2 + vy^2 + vz^2)^(0.5) ) / 2 else local vx,vy,vz = getElementVelocity(localPlayer) velocidade = math.max(1 + (vx^2 + vy^2 + vz^2)^(0.5), 2)/5 end local alt = MAP_SIZE * math.min(velocidade,2) - 80 dxDrawImageSection(0, 0, rtSX, rtSY, uvX, uvY, uvSX, uvSY, MAP_PATH) ---------------------------------------------------------------------------- local aPercent = math.abs(getTickCount()%1000 - 500) / 500 for k, Rarea in ipairs( getElementsByType("radararea") ) do if isElementVisible(Rarea) then local r, g, b, a = getRadarAreaColor(Rarea) local x, y, _ = getElementPosition(Rarea) local sx, sy = getRadarAreaSize(Rarea) local rx, ry = getImagePointFromWorld(x, y) local rsx, rsy = sx * MAP_MPP, -sy * MAP_MPP if isRadarAreaFlashing(Rarea) then a = a * aPercent end dxDrawRectangle(rx-uvX, ry-uvY, rsx, rsy, tocolor(r, g, b, a)) end end dxSetRenderTarget(radarRT1, true) dxDrawImage(0, 0, rtSX, rtSY, radarRT2, crot) dxSetBlendMode("blend") dxSetRenderTarget() dxDrawImageSection(RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, rtSX/2-RADAR_SX/2, rtSY/2-RADAR_SY/2, RADAR_SX, RADAR_SY, radarRT1, 0, 0, 0, tocolor(255, 255, 255, 11)) dxDrawImageBorder (RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, tocolor(0,0,0,255) ,2,false) -- My code function dxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end --hud health Armour --dxDrawRectangle(sW*67, sH*695, sW*241, sH*13, tocolor(0, 0, 0, 100), false) local sz1, sz2, sz3 = getHealthColor() local health = math.floor( getElementHealth( getLocalPlayer() )) if ( health <= 50) then HP_Colour = tocolor(sz1, sz2, sz3, textAlpha) HP_Alpha = tocolor(sz1, sz2, sz3, 100) else HP_Colour = tocolor(103, 188, 107, 255) HP_Alpha = tocolor(103, 188, 107, 100) end local stat = getPedStat ( getLocalPlayer(), 24 ) if stat < 1000 then dxDrawRectangle(sW*71, sH*698, sW*116, sH*7, HP_Alpha, false) --fundo dxDrawRectangle(sW*71, sH*698, sW*116/100*health, sH*7, HP_Colour, false) else dxDrawRectangle(sW*72, sH*698, sW*115, sH*7, HP_Alpha, false) --fundo dxDrawRectangle(sW*72, sH*698, sW*115/200*health, sH*7, HP_Colour, false) end if fadeIn == false then textAlpha = textAlpha - 7 elseif fadeIn == true then textAlpha = textAlpha + 7 end checkApha() local armour = getPedArmor ( getLocalPlayer() ) dxDrawRectangle(sW*190, sH*698, sW*55, sH*7, tocolor(95, 165, 206, 100), false) if armour>0 then dxDrawRectangle(sW*190, sH*698, sW*55/100*armour, sH*7, tocolor(95, 165, 206, 255), false) end local oxigenio= getPedOxygenLevel ( getLocalPlayer() ) dxDrawRectangle(sW*248, sH*698, sW*56, sH*7, tocolor(253, 219, 36, 140), false) if oxigenio < 1000 or isElementInWater (getLocalPlayer()) then dxDrawRectangle(sW*248, sH*698, sW*55, sH*7, tocolor(61, 94, 112, 255), false) dxDrawRectangle(sW*248, sH*698, sW*55/1000*oxigenio, sH*7, tocolor(169, 222, 246, 255), false) end addEventHandler("onClientRender", root, renderRadar) Edited May 6, 2015 by Guest Link to comment
Blaawee Posted May 5, 2015 Share Posted May 5, 2015 All these post and you just only keep saying debugscript? Seriously??! it's so simple, after creating your main render target just add which i guess it's 'radarRT2' : dxSetTextureEdge( radarRT2, "border", tocolor( 255, 255, 255, 100 ) ) Look complete function function renderRadar() if not radarRT1 and radarRT2 then return end dxDrawImage(70*sW, 697*sH, 236*sW, 9*sH, "sz/blips/radarbg.png", 0, 0, 0, tocolor(0, 0, 0, RBACK_ALPHA)) local px, py, pz = getElementPosition(localPlayer) local _, _, crot = getElementRotation(getCamera()) if getElementInterior(localPlayer) == 0 then local mpx, mpy = getImagePointFromWorld(px, py) local rtSX, rtSY = dxGetMaterialSize(radarRT1) local uvX, uvY = mpx-(rtSX/2), mpy-(rtSY/2) local uvSX, uvSY = rtSX, rtSY dxSetRenderTarget(radarRT2, true) dxSetBlendMode("modulate_add") ---------------------------------------------------------------------------- local vehicle = getPedOccupiedVehicle (localPlayer) if isPedInVehicle(localPlayer) then local vx,vy,vz = getElementVelocity(vehicle) velocidade = ( 1 + (vx^2 + vy^2 + vz^2)^(0.5) ) / 2 else local vx,vy,vz = getElementVelocity(localPlayer) velocidade = math.max(1 + (vx^2 + vy^2 + vz^2)^(0.5), 2)/5 end local alt = MAP_SIZE * math.min(velocidade,2) - 80 dxDrawImageSection(0, 0, rtSX, rtSY, uvX, uvY, uvSX, uvSY, MAP_PATH) ---------------------------------------------------------------------------- local aPercent = math.abs(getTickCount()%1000 - 500) / 500 for k, Rarea in ipairs( getElementsByType("radararea") ) do if isElementVisible(Rarea) then local r, g, b, a = getRadarAreaColor(Rarea) local x, y, _ = getElementPosition(Rarea) local sx, sy = getRadarAreaSize(Rarea) local rx, ry = getImagePointFromWorld(x, y) local rsx, rsy = sx * MAP_MPP, -sy * MAP_MPP if isRadarAreaFlashing(Rarea) then a = a * aPercent end dxDrawRectangle(rx-uvX, ry-uvY, rsx, rsy, tocolor(r, g, b, a)) end end dxSetRenderTarget(radarRT1, true) dxDrawImage(0, 0, rtSX, rtSY, radarRT2, crot) dxSetBlendMode("blend") dxSetRenderTarget() dxDrawImageSection(RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, rtSX/2-RADAR_SX/2, rtSY/2-RADAR_SY/2, RADAR_SX, RADAR_SY, radarRT1, 0, 0, 0, tocolor(255, 255, 255, 11)) dxDrawImageBorder (RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, tocolor(0,0,0,255) ,2,false) -- My code function dxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end --hud health Armour --dxDrawRectangle(sW*67, sH*695, sW*241, sH*13, tocolor(0, 0, 0, 100), false) local sz1, sz2, sz3 = getHealthColor() local health = math.floor( getElementHealth( getLocalPlayer() )) if ( health <= 50) then HP_Colour = tocolor(sz1, sz2, sz3, textAlpha) HP_Alpha = tocolor(sz1, sz2, sz3, 100) else HP_Colour = tocolor(103, 188, 107, 255) HP_Alpha = tocolor(103, 188, 107, 100) end local stat = getPedStat ( getLocalPlayer(), 24 ) if stat < 1000 then dxDrawRectangle(sW*71, sH*698, sW*116, sH*7, HP_Alpha, false) --fundo dxDrawRectangle(sW*71, sH*698, sW*116/100*health, sH*7, HP_Colour, false) else dxDrawRectangle(sW*72, sH*698, sW*115, sH*7, HP_Alpha, false) --fundo dxDrawRectangle(sW*72, sH*698, sW*115/200*health, sH*7, HP_Colour, false) end if fadeIn == false then textAlpha = textAlpha - 7 elseif fadeIn == true then textAlpha = textAlpha + 7 end checkApha() local armour = getPedArmor ( getLocalPlayer() ) dxDrawRectangle(sW*190, sH*698, sW*55, sH*7, tocolor(95, 165, 206, 100), false) if armour>0 then dxDrawRectangle(sW*190, sH*698, sW*55/100*armour, sH*7, tocolor(95, 165, 206, 255), false) end local oxigenio= getPedOxygenLevel ( getLocalPlayer() ) dxDrawRectangle(sW*248, sH*698, sW*56, sH*7, tocolor(253, 219, 36, 140), false) if oxigenio < 1000 or isElementInWater (getLocalPlayer()) then dxDrawRectangle(sW*248, sH*698, sW*55, sH*7, tocolor(61, 94, 112, 255), false) dxDrawRectangle(sW*248, sH*698, sW*55/1000*oxigenio, sH*7, tocolor(169, 222, 246, 255), false) --Players for k, player in ipairs( getElementsByType("player") ) do if player ~= localPlayer then local x, y, z = getElementPosition(player) local r, g, b = getPlayerNametagColor(player) local rx, ry = getRadarFromWorldPosition(x, y) local icon = "square" if z < pz-2 then icon = "down" elseif z > pz+2 then icon = "up" end dxDrawImage(floor(rx - PLAYERS_SIZE/2), floor(ry - PLAYERS_SIZE/2), floor(PLAYERS_SIZE), floor(PLAYERS_SIZE), "sz/blips/"..icon..".png", 0, 0, 0, tocolor(r, g, b, PLAYERS_ALPHA)) end end end weapon = getPedWeapon ( getLocalPlayer() ) local t1, t2, t3 = getElementPosition(getLocalPlayer()) local r1, r2, r3 = getElementRotation(getLocalPlayer()) local Test = math.floor((t3*001)) if not ( isPedInVehicle(localPlayer) ) then if ( weapon == 46 ) then dxDrawImage(sW*70, sH*610, 235, 30, "sz/blips/rotation.png", r2, tocolor(255, 255, 255 , 255)) dxDrawImage(sW*113, sH*560, 150, 80, "sz/blips/mask.png", 0,0,0, tocolor(255, 255, 255 , 255)) --dxDrawRectangle(sW*255, sH*679, sW*50, sH*16, tocolor(0, 0, 0, 100), false)--fundo dxDrawBorderedText(Test.."Mts",sW*150, sH*680, sW*605/2, sH*30/2,tocolor(255,255,255,255),1.0,"default-bold","right","top",false,false,false) end end end addEventHandler("onClientRender", root, renderRadar) What a mess. Link to comment
Walid Posted May 5, 2015 Share Posted May 5, 2015 Man put my code outside the client render event. Many things Wrong function renderRadar() if not radarRT1 and radarRT2 then return end dxDrawImage(70*sW, 697*sH, 236*sW, 9*sH, "sz/blips/radarbg.png", 0, 0, 0, tocolor(0, 0, 0, RBACK_ALPHA)) local px, py, pz = getElementPosition(localPlayer) local _, _, crot = getElementRotation(getCamera()) if getElementInterior(localPlayer) == 0 then local mpx, mpy = getImagePointFromWorld(px, py) local rtSX, rtSY = dxGetMaterialSize(radarRT1) local uvX, uvY = mpx-(rtSX/2), mpy-(rtSY/2) local uvSX, uvSY = rtSX, rtSY dxSetRenderTarget(radarRT2, true) dxSetBlendMode("modulate_add") ---------------------------------------------------------------------------- local vehicle = getPedOccupiedVehicle (localPlayer) if isPedInVehicle(localPlayer) then local vx,vy,vz = getElementVelocity(vehicle) velocidade = ( 1 + (vx^2 + vy^2 + vz^2)^(0.5) ) / 2 else local vx,vy,vz = getElementVelocity(localPlayer) velocidade = math.max(1 + (vx^2 + vy^2 + vz^2)^(0.5), 2)/5 end local alt = MAP_SIZE * math.min(velocidade,2) - 80 dxDrawImageSection(0, 0, rtSX, rtSY, uvX, uvY, uvSX, uvSY, MAP_PATH) ---------------------------------------------------------------------------- local aPercent = math.abs(getTickCount()%1000 - 500) / 500 for k, Rarea in ipairs( getElementsByType("radararea") ) do if isElementVisible(Rarea) then local r, g, b, a = getRadarAreaColor(Rarea) local x, y, _ = getElementPosition(Rarea) local sx, sy = getRadarAreaSize(Rarea) local rx, ry = getImagePointFromWorld(x, y) local rsx, rsy = sx * MAP_MPP, -sy * MAP_MPP if isRadarAreaFlashing(Rarea) then a = a * aPercent end dxDrawRectangle(rx-uvX, ry-uvY, rsx, rsy, tocolor(r, g, b, a)) end end dxSetRenderTarget(radarRT1, true) dxDrawImage(0, 0, rtSX, rtSY, radarRT2, crot) --Occupied Vehicle local veh = getPedOccupiedVehicle(localPlayer) if veh then local vehType = getVehicleType(veh) if vehType == "Plane" or vehType == "Helicopter" then local sx, sy = RADAR_SX + sOffset, RADAR_SY + sOffset local mx, my = sx/2, sy/2 local imgSX, imgSY = 150*sW, 80*sH dxDrawImage(mx - (imgSX/2), sOffset/2, imgSX, imgSY, "sz/blips/mask.png") local rx, ry, rz = getElementRotation(veh) imgSX, imgSY = 466*sW, 50*sH dxDrawImage(mx - (imgSX/2), my - (imgSY/2), imgSX, imgSY, "sz/blips/rotation.png", ry) end end dxSetBlendMode("blend") dxSetRenderTarget() dxDrawImageSection(RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, rtSX/2-RADAR_SX/2, rtSY/2-RADAR_SY/2, RADAR_SX, RADAR_SY, radarRT1, 0, 0, 0, tocolor(255, 255, 255, 11)) dxDrawImageBorder (RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, tocolor(0,0,0,255) ,2,false) --hud health Armour --dxDrawRectangle(sW*67, sH*695, sW*241, sH*13, tocolor(0, 0, 0, 100), false) local sz1, sz2, sz3 = getHealthColor() local health = math.floor( getElementHealth( getLocalPlayer() )) if ( health <= 50) then HP_Colour = tocolor(sz1, sz2, sz3, textAlpha) HP_Alpha = tocolor(sz1, sz2, sz3, 100) else HP_Colour = tocolor(103, 188, 107, 255) HP_Alpha = tocolor(103, 188, 107, 100) end local stat = getPedStat ( getLocalPlayer(), 24 ) if stat < 1000 then dxDrawRectangle(sW*71, sH*698, sW*116, sH*7, HP_Alpha, false) --fundo dxDrawRectangle(sW*71, sH*698, sW*116/100*health, sH*7, HP_Colour, false) else dxDrawRectangle(sW*72, sH*698, sW*115, sH*7, HP_Alpha, false) --fundo dxDrawRectangle(sW*72, sH*698, sW*115/200*health, sH*7, HP_Colour, false) end if fadeIn == false then textAlpha = textAlpha - 7 elseif fadeIn == true then textAlpha = textAlpha + 7 end checkApha() local armour = getPedArmor ( getLocalPlayer() ) dxDrawRectangle(sW*190, sH*698, sW*55, sH*7, tocolor(95, 165, 206, 100), false) if armour>0 then dxDrawRectangle(sW*190, sH*698, sW*55/100*armour, sH*7, tocolor(95, 165, 206, 255), false) end local oxigenio= getPedOxygenLevel ( getLocalPlayer() ) dxDrawRectangle(sW*248, sH*698, sW*56, sH*7, tocolor(253, 219, 36, 140), false) if oxigenio < 1000 or isElementInWater (getLocalPlayer()) then dxDrawRectangle(sW*248, sH*698, sW*55, sH*7, tocolor(61, 94, 112, 255), false) dxDrawRectangle(sW*248, sH*698, sW*55/1000*oxigenio, sH*7, tocolor(169, 222, 246, 255), false) end --Players for k, player in ipairs( getElementsByType("player") ) do if player ~= localPlayer then local x, y, z = getElementPosition(player) local r, g, b = getPlayerNametagColor(player) local rx, ry = getRadarFromWorldPosition(x, y) local icon = "square" if z < pz-2 then icon = "down" elseif z > pz+2 then icon = "up" end dxDrawImage(floor(rx - PLAYERS_SIZE/2), floor(ry - PLAYERS_SIZE/2), floor(PLAYERS_SIZE), floor(PLAYERS_SIZE), "sz/blips/"..icon..".png", 0, 0, 0, tocolor(r, g, b, PLAYERS_ALPHA)) end end end weapon = getPedWeapon ( getLocalPlayer() ) local t1, t2, t3 = getElementPosition(getLocalPlayer()) local r1, r2, r3 = getElementRotation(getLocalPlayer()) local Test = math.floor((t3*001)) if not ( isPedInVehicle(localPlayer) ) then if ( weapon == 46 ) then dxDrawImage(sW*70, sH*610, 235, 30, "sz/blips/rotation.png", r2, tocolor(255, 255, 255 , 255)) dxDrawImage(sW*113, sH*560, 150, 80, "sz/blips/mask.png", 0,0,0, tocolor(255, 255, 255 , 255)) dxDrawBorderedText(Test.."Mts",sW*150, sH*680, sW*605/2, sH*30/2,tocolor(255,255,255,255),1.0,"default-bold","right","top",false,false,false) end end end addEventHandler("onClientRender", root, renderRadar) -- My code function dxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end Link to comment
SpoC^ Posted May 6, 2015 Author Share Posted May 6, 2015 (edited) Man put my code outside the client render event. Many things Wrong function renderRadar() if not radarRT1 and radarRT2 then return end dxDrawImage(70*sW, 697*sH, 236*sW, 9*sH, "sz/blips/radarbg.png", 0, 0, 0, tocolor(0, 0, 0, RBACK_ALPHA)) ---------------------------------------------------------------------------- local vehicle = getPedOccupiedVehicle (localPlayer) if isPedInVehicle(localPlayer) then local vx,vy,vz = getElementVelocity(vehicle) velocidade = ( 1 + (vx^2 + vy^2 + vz^2)^(0.5) ) / 2 else local vx,vy,vz = getElementVelocity(localPlayer) velocidade = math.max(1 + (vx^2 + vy^2 + vz^2)^(0.5), 2)/5 end local alt = MAP_SIZE * math.min(velocidade,2) - 80 dxDrawImageSection(0, 0, rtSX, rtSY, uvX, uvY, uvSX, uvSY, MAP_PATH) ---------------------------------------------------------------------------- local aPercent = math.abs(getTickCount()%1000 - 500) / 500 for k, Rarea in ipairs( getElementsByType("radararea") ) do if isElementVisible(Rarea) then local r, g, b, a = getRadarAreaColor(Rarea) local x, y, _ = getElementPosition(Rarea) local sx, sy = getRadarAreaSize(Rarea) local rx, ry = getImagePointFromWorld(x, y) local rsx, rsy = sx * MAP_MPP, -sy * MAP_MPP if isRadarAreaFlashing(Rarea) then a = a * aPercent end dxDrawRectangle(rx-uvX, ry-uvY, rsx, rsy, tocolor(r, g, b, a)) end end dxSetRenderTarget(radarRT1, true) dxDrawImage(0, 0, rtSX, rtSY, radarRT2, crot) --Occupied Vehicle local veh = getPedOccupiedVehicle(localPlayer) if veh then local vehType = getVehicleType(veh) if vehType == "Plane" or vehType == "Helicopter" then local sx, sy = RADAR_SX + sOffset, RADAR_SY + sOffset local mx, my = sx/2, sy/2 local imgSX, imgSY = 150*sW, 80*sH dxDrawImage(mx - (imgSX/2), sOffset/2, imgSX, imgSY, "sz/blips/mask.png") local rx, ry, rz = getElementRotation(veh) imgSX, imgSY = 466*sW, 50*sH dxDrawImage(mx - (imgSX/2), my - (imgSY/2), imgSX, imgSY, "sz/blips/rotation.png", ry) end end dxSetBlendMode("blend") dxSetRenderTarget() dxDrawImageSection(RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, rtSX/2-RADAR_SX/2, rtSY/2-RADAR_SY/2, RADAR_SX, RADAR_SY, radarRT1, 0, 0, 0, tocolor(255, 255, 255, 11)) dxDrawImageBorder (RADAR_X-10, RADAR_Y-10, RADAR_SX+20, RADAR_SY+20, tocolor(0,0,0,255) ,2,false) --hud health Armour --dxDrawRectangle(sW*67, sH*695, sW*241, sH*13, tocolor(0, 0, 0, 100), false) local sz1, sz2, sz3 = getHealthColor() local health = math.floor( getElementHealth( getLocalPlayer() )) if ( health <= 50) then HP_Colour = tocolor(sz1, sz2, sz3, textAlpha) HP_Alpha = tocolor(sz1, sz2, sz3, 100) else HP_Colour = tocolor(103, 188, 107, 255) HP_Alpha = tocolor(103, 188, 107, 100) end local stat = getPedStat ( getLocalPlayer(), 24 ) if stat < 1000 then dxDrawRectangle(sW*71, sH*698, sW*116, sH*7, HP_Alpha, false) --fundo dxDrawRectangle(sW*71, sH*698, sW*116/100*health, sH*7, HP_Colour, false) else dxDrawRectangle(sW*72, sH*698, sW*115, sH*7, HP_Alpha, false) --fundo dxDrawRectangle(sW*72, sH*698, sW*115/200*health, sH*7, HP_Colour, false) end if fadeIn == false then textAlpha = textAlpha - 7 elseif fadeIn == true then textAlpha = textAlpha + 7 end checkApha() local armour = getPedArmor ( getLocalPlayer() ) dxDrawRectangle(sW*190, sH*698, sW*55, sH*7, tocolor(95, 165, 206, 100), false) if armour>0 then dxDrawRectangle(sW*190, sH*698, sW*55/100*armour, sH*7, tocolor(95, 165, 206, 255), false) end local oxigenio= getPedOxygenLevel ( getLocalPlayer() ) dxDrawRectangle(sW*248, sH*698, sW*56, sH*7, tocolor(253, 219, 36, 140), false) if oxigenio < 1000 or isElementInWater (getLocalPlayer()) then dxDrawRectangle(sW*248, sH*698, sW*55, sH*7, tocolor(61, 94, 112, 255), false) dxDrawRectangle(sW*248, sH*698, sW*55/1000*oxigenio, sH*7, tocolor(169, 222, 246, 255), false) end addEventHandler("onClientRender", root, renderRadar) -- My code function dxDrawImageBorder (corX, corY, imageWidth, imageHeight, lineColor, lineWidth, postGUI ) local lineWidth = lineWidth or 1 dxDrawLine ( corX, corY, corX+imageWidth, corY, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY, corX, corY+imageHeight, lineColor, lineWidth, postGUI ) dxDrawLine ( corX, corY+imageHeight, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) return dxDrawLine ( corX+imageWidth, corY, corX+imageWidth, corY+imageHeight, lineColor, lineWidth, postGUI ) end look the result Edited May 6, 2015 by Guest 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