dthxxx666 Posted October 19, 2018 Share Posted October 19, 2018 Hola gente , Estaba buscando la manera de ocultar un radar que puse , uno rectangular que agregué tipo gta 5 en el caso de otro externo no se si se usa setPlayerHudComponentVisible o se exporta alguna funcion no tengo idea aca lel script del radar local enableBlips = true local renderNorthBlip = true local alwaysRenderMap = false local alwaysRenderOxygen = false local disableGTASAhealth = true local disableGTASAarmor = true local disableGTASAoxygen = true local worldW, worldH = 3072, 3072 local blip = 8 local healthOkayR, healthOkayG, healthOkayB = 255, 165, 0 local healthBadR, healthBadG, healthBadB = 255, 165, 0 local healthCriticalR, healthCriticalG, healthCriticalB = 255, 165, 0 local armorColorR, armorColorG, armorColorB = 0, 206, 209 local oxygenColorR, oxygenColorG, oxygenColorB = 250, 250, 210 local sx, sy = guiGetScreenSize() local rt = dxCreateRenderTarget(290, 175) local xFactor, yFactor = sx/1366, sy/768 local yFactor = xFactor function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end function drawRadar() setPlayerHudComponentVisible("radar", false) if disableGTASAhealth then setPlayerHudComponentVisible("health", false) end if disableGTASAarmor then setPlayerHudComponentVisible("armour", false) end if disableGTASAoxygen then setPlayerHudComponentVisible("breath", false) end if (not isPlayerMapVisible()) then local mW, mH = dxGetMaterialSize(rt) local x, y = getElementPosition(localPlayer) local X, Y = mW/2 -(x/(6000/worldW)), mH/2 +(y/(6000/worldH)) local camX,camY,camZ = getElementRotation(getCamera()) dxSetRenderTarget(rt, true) if alwaysRenderMap or getElementInterior(localPlayer) == 0 then dxDrawRectangle(0, 0, mW, mH, 0xFF7CA7D1) dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "image/world.png", camZ, (x/(6000/worldW)), -(y/(6000/worldH))) end dxSetRenderTarget() dxDrawRectangle((30)*xFactor, sy-((198+10))*yFactor, (271)*xFactor, (164)*yFactor, tocolor(0, 0, 0, 190)) dxDrawRectangle((27)*xFactor, sy-((15))*yFactor, (278)*xFactor, (-20)*yFactor, tocolor(0, 0, 0, 190)) dxDrawImage((30+5)*xFactor, sy-((200+5))*yFactor, (270-10)*xFactor, (155)*yFactor, rt, 0, 0, 0, tocolor(255, 255, 255, 120)) local health = math.max(math.min(getElementHealth(localPlayer)/(0.232018558500192*getPedStat(localPlayer, 24) -32.018558511152), 1), 0) local armor = math.max(math.min(getPedArmor(localPlayer)/150, 1), 0) local oxygen = math.max(math.min(getPedOxygenLevel(localPlayer)/(1.5*getPedStat(localPlayer, 225) +1000), 1), 0) local r, g, b if health >= 0.25 then r, g, b = interpolateBetween(healthBadR, healthBadG, healthBadB, healthOkayR, healthOkayG, healthOkayB, math.floor(health*20)/10, "InOutQuad") else r, g, b = interpolateBetween(healthCriticalR, healthCriticalB, healthCriticalB, healthBadR, healthBadG, healthBadB, math.floor(health*20)/10, "InOutQuad") end local col = tocolor(r, g, b, 200) local bg = tocolor(r, g, b, 150) dxDrawRectangle((35)*xFactor, sy-(30)*yFactor, (122.5)*xFactor, (10)*yFactor, bg) dxDrawRectangle((35)*xFactor, sy-(30)*yFactor, (122.5*health)*xFactor, (10)*yFactor, col) if alwaysRenderOxygen or (oxygen < 1 or isElementInWater(localPlayer)) then dxDrawRectangle((162.5)*xFactor, sy-(30)*yFactor, (67.5)*xFactor, (10)*yFactor, tocolor(armorColorR, armorColorG, armorColorB, 150)) dxDrawRectangle((162.5)*xFactor, sy-(30)*yFactor, (67.5*armor)*xFactor, (10)*yFactor, tocolor(armorColorR, armorColorG, armorColorB, 200)) dxDrawRectangle((237.5)*xFactor, sy-(30)*yFactor, (57.5)*xFactor, (10)*yFactor, tocolor(oxygenColorR, oxygenColorG, oxygenColorB, 150)) dxDrawRectangle((237.5)*xFactor, sy-(30)*yFactor, (57.5*oxygen)*xFactor, (10)*yFactor, tocolor(oxygenColorR, oxygenColorG, oxygenColorB, 200)) else dxDrawRectangle((162.5)*xFactor, sy-(30)*yFactor, (132.5)*xFactor, (10)*yFactor, tocolor(armorColorR, armorColorG, armorColorB, 150)) dxDrawRectangle((162.5)*xFactor, sy-(30)*yFactor, (132.5*armor)*xFactor, (10)*yFactor, tocolor(armorColorR, armorColorG, armorColorB, 200)) end local rx, ry, rz = getElementRotation(localPlayer) local lB = (33)*xFactor local rB = (8+290)*xFactor local tB = sy-(208)*yFactor local bB = tB + (155)*yFactor local cX, cY = (rB+lB)/2, (tB+bB)/2 +(35)*yFactor local toLeft, toTop, toRight, toBottom = cX-lB, cY-tB, rB-cX, bB-cY for k, v in ipairs(getElementsByType("blip")) do local bx, by = getElementPosition(v) local actualDist = getDistanceBetweenPoints2D(x, y, bx, by) local maxDist = getBlipVisibleDistance(v) if actualDist <= maxDist and getElementDimension(v)==getElementDimension(localPlayer) and getElementInterior(v)==getElementInterior(localPlayer) then local dist = actualDist/(6000/((worldW+worldH)/2)) local rot = findRotation(bx, by, x, y)-camZ local bpx, bpy = getPointFromDistanceRotation(cX, cY, math.min(dist, math.sqrt(toTop^2 + toRight^2)), rot) local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) local bid = getElementData(v, "customIcon") or getBlipIcon(v) local _, _, _, bcA = getBlipColor(v) local bcR, bcG, bcB = 255, 255, 255 if getBlipIcon(v) == 0 then bcR, bcG, bcB = getBlipColor(v) end local bS = getBlipSize(v) dxDrawImage(bpx -(blip*bS)*xFactor/2, bpy -(blip*bS)*yFactor/2, (blip*bS)*xFactor, (blip*bS)*yFactor, "image/blip/"..bid..".png", 0, 0, 0, tocolor(bcR, bcG, bcB, bcA)) end end if renderNorthBlip then local rot = -camZ+180 local bpx, bpy = getPointFromDistanceRotation(cX, cY, math.sqrt(toTop^2 + toRight^2), rot) local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) local dist = getDistanceBetweenPoints2D(cX, cY, bpx, bpy) local bpx, bpy = getPointFromDistanceRotation(cX, cY, dist, rot) if bpx and bpy then local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) dxDrawImage(bpx -(blip*2)/2, bpy -(blip*2)/2, blip*2, blip*2, "image/blip/4.png", 0, 0, 0) --draw north (4) blip end end dxDrawImage(cX -(blip*2)*xFactor/2, cY -(blip*2)*yFactor/2, (blip*2)*xFactor, (blip*2)*yFactor, "image/player.png", camZ-rz, 0, 0) end end addEventHandler("onClientRender", root, drawRadar) addEventHandler("onClientResourceStop", resourceRoot, function() setPlayerHudComponentVisible("radar", true) if disableGTASAhealth then setPlayerHudComponentVisible("health", true) end if disableGTASAarmor then setPlayerHudComponentVisible("armour", true) end if disableGTASAoxygen then setPlayerHudComponentVisible("breath", true) end end) if fileExists("radar.lua") then fileDelete("radar.lua") end 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