Search the Community
Showing results for tags 'radar'.
-
radar script is really cool. I want to use it on my server but I want it to work with acl. So the clan's radar will not show the people in that clan, it will only be visible if someone else enters it. Can you help me do this please? local screenX, screenY = guiGetScreenSize() local angle = 0 local visible = false local lineVisible = false local tick = getTickCount() local radares = {} local elementsDetected = {} -- local radius = 20 -- radius local centerPos = {-1344.0895996094, -42.202056884766, 10, 10} -- Edit position of radar: x, y, z, height local radarColshape = createColCircle(centerPos[1], centerPos[2], radius) -- function attachRadarToElement(element) if isElement(element) then centerPos = element end end function createRadar(posX, posY, size) table.insert(radares, {x = posX, y = posY, s = size, r = (size - (size*40/300))/2}) end createRadar(screenX - 366, screenY - 318, 300) local function linear(t, b, c, d) return c * t / d + b end function radar() local now = getTickCount() if now-tick >= 50 then tick = getTickCount() angle = angle < 360 and angle + 2 or 0 end if visible then for _, v in ipairs(radares) do dxDrawImage(v.x, v.y, v.s, v.s, "images/radar.png") local centerX, centerY = v.x+v.s/2, v.y+v.s/2 for i = -30, 1 do local alpha = 8.5*i local endX = math.cos( math.rad( angle + i*2 ) ) * v.r local endY = -math.sin( math.rad( angle + i*2 ) ) * v.r local lineX, lineY = centerX, centerY dxDrawLine(lineX, lineY, endX + lineX, endY + lineY, tocolor(0, 255, 0, alpha), 7) end for element, b in pairs(elementsDetected) do local elapsedTime = now - b[1] if elapsedTime < 3000 then local alpha = linear(elapsedTime, 255, -255, 3000) local hip = (v.r*b[3])/radius local x, y = math.cos(b[2]) * hip, math.sin(b[2]) * hip dxDrawImage(centerX-8+x, centerY-8-y, 16, 16, "images/56.png", _, _, _, tocolor(255, 255, 255, alpha)) else elementsDetected[element] = nil end end end end end addEventHandler("onClientRender", root, radar) -- addEventHandler("onClientPreRender", root, function() local centerX, centerY, centerZ, height if not isElement(centerPos) then centerX, centerY, centerZ, height = unpack( centerPos ) else centerX, centerY, centerZ = getElementPosition(centerPos) height = 10 end if lineVisible then for i = 1, 360, 45 do local endX = math.cos( math.rad( i ) ) * radius local endY = math.sin( math.rad( i ) ) * radius dxDrawLine3D(centerX, centerY, centerZ + height, endX + centerX, endY + centerY, centerZ + height, tocolor(255, 255, 0, 150), 7) dxDrawLine3D(endX + centerX, endY + centerY, centerZ, endX + centerX, endY + centerY, centerZ+height, tocolor(255, 255, 0, 150), 7) end local endX, endY = math.cos( math.rad( angle ) ) * radius, math.sin( math.rad( angle ) ) * radius local endX2, endY2 = math.cos( math.rad( angle - 10 ) ) * radius, math.sin( math.rad( angle - 10 ) ) * radius local middleZ = (centerZ + height) dxDrawLine3D(centerX, centerY, middleZ, endX + centerX, endY + centerY, middleZ, tocolor(255, 0, 0, 150), 3) dxDrawLine3D(centerX, centerY, middleZ, endX2 + centerX, endY2 + centerY, middleZ, tocolor(255, 0, 0, 150), 3) dxDrawLine3D( endX + centerX, endY + centerY, middleZ, endX2 + centerX, endY2 + centerY, middleZ, tocolor(255, 0, 0, 150), 3) end local elements = getElementsWithinColShape(radarColshape) for e = 1, #elements do local x, y, z = getElementPosition(elements[e]) local hipotenusa = ( (x-centerX)^2 + (y-centerY)^2 ) ^ .5 local eAngle = math.acos( (x-centerX) / hipotenusa ) eAngle = (y-centerY) < 0 and math.pi*2 - eAngle or eAngle --local xFrom, yFrom = math.cos(eAngle)*hipotenusa, math.sin(eAngle)*hipotenusa --dxDrawLine3D(centerX, centerY, 7, xFrom + centerX, yFrom + centerY, z, tocolor(0, 255, 0, 150), 3) -- To see where the element is supposed to be if eAngle >= math.rad( angle - 10 ) and eAngle <= math.rad ( angle ) then if visible and not elementsDetected[elements[e]] then playSoundFrontEnd(5) end elementsDetected[elements[e]] = {getTickCount(), eAngle, hipotenusa} end end end ) addCommandHandler("radar2", function() visible = not visible end ) addCommandHandler("radarline", function() lineVisible = not lineVisible end )
-
My radar source is there; but radar areas, which is created with (createRadarArea) function, is not visible on the radar. How can I add it? local enableBlips = true local renderNorthBlip = true local alwaysRenderMap = false local worldW, worldH = 1800,1800 local blip = 8 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 RADAR() --Radar config setPlayerHudComponentVisible("area_name", false) setPlayerHudComponentVisible("vehicle_name", false) setPlayerHudComponentVisible("radar", false) 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, "gfx/world.png", camZ, (x/(6000/worldW)), -(y/(6000/worldH))) -- dxSetRenderTarget() dxDrawImage((18)*xFactor, sy-((216))*yFactor, (293)*xFactor, (177)*yFactor, "gfx/radarbg.png", 0, 0, 0, tocolor(0, 0, 0, 180)) dxDrawImage((30+5)*xFactor, sy-((200+5))*yFactor, (270-10)*xFactor, (155)*yFactor, rt, 0, 0, 0, tocolor(255, 255, 255, 80)) --# Blips 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, "gfx/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,"gfx/blip/4.png",0,0,0) end end dxDrawImage(cX -(blip*2)*xFactor/2,cY -(blip*2)*yFactor/2,(blip*2)*xFactor,(blip*2)*yFactor, "gfx/player.png", camZ-rz, 0, 0) end end addEventHandler("onClientRender", root, RADAR) function Visible() if isVisible then addEventHandler("onClientRender", root, RADAR) else removeEventHandler("onClientRender", root, RADAR) end isVisible = not isVisible end bindKey ("F11", "down", Visible)
-
Eu preciso fazer este circulo ao redor do blip, alguém pode me ajudar? https://prntscr.com/wid38f
-
I am selling a SA map in vector format (*.ai, *.psd). It's extremely convenient for designers and server administrators who want to quickly recolor the map into the desired palette to fit their server's theme. Make any palette you want - be it blue, gray or pink (example palettes on the screenshots have been made in a couple of minutes). You want to quickly add/remove mapping elements to/from a map? Have been asked to recolor the map but tweaking selection and masks is incredibly slow and tedious? Want to add player-customizable palettes but the former designer didn't make enough color variations? This is all in the past. Support is available. PM me for the price details: forum: @easterdie telegram: @easterdie discord: Стар Хариф#4358 vk.com/easterdie Usage example: SCREENSHOTS:
-
Olá eu possuo um radar que quando você esta forá de um veiculo o radar fica em com a visão sobre a sua localização, quando você entra em um veiculo ele da uma deitada deixando 3D. Gostaria de saber como faço para que a pessoa so consiga ver o radar apenas quando elas entrarem no veiculos, e assim que a pessoa sair do veiculo o radar é removido. Download do Radar(Mini-Mapa) Abraço...
-
Selam. MTA sunucuları basite indirgenmiş "Araç,Karakter,Silah,Blip (Haritada Simge),Kodlu Kapı,3D Ses" oluşturucu programımı bitirip sizlerle paylaşmak istedim. Klasörleri programın çalıştığı dizine oluşturur. Araç ve Silah ID'leri isimleri ile beraber sizin için hazır olarak ComboBox'a eklenmiştir. Programa dair görüntüler; VirusTotal: https://www.virustotal.com/#/file/ab64043693b44cec50caa1358bc7b6fe279758f5962b08cbded351fb706a1d5a/detection Link: http://link.tl/1jzJ9 Programın sorunlarını ve eksik bulduğunuz kısımları bildirirseniz mutlu olurum.
-
Hello guys! I have an issue with my radar script and I can't fix it. I wanted to draw the server's blips to the player's minimap, but i don't know how to calculate the X,Y coordinates on the radar when I rotate my camera. That's my client side script: local c = exports.gw_core local screenX,screenY = guiGetScreenSize() local fonts = c:getFonts() local options = c:getOptions() local s = c:getSize(300) local bx,by = c:getSize(50), screenY - c:getSize(50)-s local x,y = c:getSize(60), screenY - c:getSize(40) - s local arrowSize = c:getSize(30) local bs = s*2 local mapTarget = dxCreateRenderTarget(bs,bs) local map = dxCreateTexture('world.jpg') local blipTarget = dxCreateRenderTarget(3000,3000) setPlayerHudComponentVisible ( 'radar',false) function getMapCord(element) local x,y = getElementPosition(element) local imgSize = 3072 return ((x + 3000) / 6000) * imgSize, (-(y - 3000) / 6000) * imgSize end local blip = createBlip (1962.291015625,-1751.20703125,13.3828125, 0) addEventHandler('onClientRender',root,function() local _,_,r = getElementRotation(getCamera()) local _,_,pr = getElementRotation(localPlayer) local posX,posY = getMapCord(localPlayer) dxSetRenderTarget(blipTarget) dxDrawImageSection ( posX - bs/2, posY - bs/2, bs,bs,posX - bs/2, posY - bs/2, bs,bs,map,r) for k,v in pairs(getElementsByType('blip')) do local blipX,blipY = getMapCord(v) dxDrawImage(blipX - 10, blipY - 10, 20, 20, 'player.png'); -- I don't have blip images yet end dxSetRenderTarget() dxDrawRectangle ( bx,by,s+c:getSize(20),s+c:getSize(20), options.panelDark) dxDrawImageSection ( x,y,s,s,posX - s/2, posY - s/2, s,s,blipTarget) dxDrawImage ( x + s/2 - arrowSize/2, y + s/2 - arrowSize/2, arrowSize,arrowSize,'player.png',r-pr,0,0) end) There's the problem in the game :
- 10 replies
-
Boa tarde, como faço uma verificação se um player está em um veiculo ou não??? No meu caso, eu quero para que, se um player estiver em um veiculo, quero que apareça o Radar, agora se o player nao estiver em um veiculo, nao aparecer radar! Posso usar o que neste caso?
-
Hey guys i saw many servers have a resource make staff/Moderators able to warp using F11 map, by clicking anywhere on the map they will warp there.. like mta freeroam map warping.... So if someone have this resource pls gimme it... I want it fast, Thnx
-
someone knows how I can achieve what is shown in the following images?
- 2 replies
-
- radar
- battle royale
-
(and 2 more)
Tagged with:
-
I have a problem with the radar and I do not know how to solve it, with the radar activated, I go into some interior and the radar, hud does not work, could you help me? --# Client local enableBlips = true local renderNorthBlip = true local alwaysRenderMap = false local worldW, worldH = 1800,1800 local blip = 8 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 RADAR() --Radar config showPlayerHudComponent("area_name", false) showPlayerHudComponent("vehicle_name", false) showPlayerHudComponent("radar", false) 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, "gfx/world.png", camZ, (x/(6000/worldW)), -(y/(6000/worldH))) -- dxSetRenderTarget() dxDrawImage((18)*xFactor, sy-((216))*yFactor, (293)*xFactor, (177)*yFactor, "gfx/radarbg.png", 0, 0, 0, tocolor(0, 0, 0, 180)) dxDrawImage((30+5)*xFactor, sy-((200+5))*yFactor, (270-10)*xFactor, (155)*yFactor, rt, 0, 0, 0, tocolor(255, 255, 255, 80)) --# Blips 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, "gfx/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,"gfx/blip/4.png",0,0,0) end end dxDrawImage(cX -(blip*2)*xFactor/2,cY -(blip*2)*yFactor/2,(blip*2)*xFactor,(blip*2)*yFactor, "gfx/player.png", camZ-rz, 0, 0) end end addEventHandler("onClientRender", root, RADAR) function Visible() if isVisible then addEventHandler("onClientRender", root, RADAR) else removeEventHandler("onClientRender", root, RADAR) end isVisible = not isVisible end bindKey ("F11", "down", Visible)
-
Portuguese: Olá, tenho um grande problema, eu não consigo modificar o radar original, boto outros modificados, mas não modifica, antes eles funcionava, mas agora não quer, sabem o problema? English: Hello, I have a big problem, I can not modify the original radar, other modified port, but does not modify, before they worked, but now do not want, know the problem?
-
Hi there everyone. Well I'm using the radar made by "Vandam" and made modifications to leave to my liking. But I can not get him to display the blips on the edge as the original radar does anyone could help me or tell me how to perform ?? How are you doing : As I want: Code:
-
local movingOffsetX, movingOffsetY = 0, 0 local isMoving = false bindKey('m', 'down', function() showCursor(not isCursorShowing()); end ) function drawRadar() showPlayerHudComponent("radar", false) if disableGTASAhealth then showPlayerHudComponent("health", false) end if disableGTASAarmor then showPlayerHudComponent("armour", false) end if disableGTASAoxygen then showPlayerHudComponent("breath", false) end if (not isPlayerMapVisible()) then if (isCursorShowing() and isMoving) then local cursorX, cursorY = getCursorPosition(); cursorX = cursorX * sx; cursorY = cursorY * sy; xFactor = cursorX - movingOffsetX; yFactor = cursorY - movingOffsetY; end 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(xFactor, yFactor, worldW, worldH, 0xFF5E656B) dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "image/world.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) end dxSetRenderTarget() dxDrawRectangle((10)*xFactor, sy-((200+10))*yFactor, (300)*xFactor, (184)*yFactor, tocolor(0, 0, 0, 175)) dxDrawImage((10+5)*xFactor, sy-((200+5))*yFactor, (300-10)*xFactor, (175)*yFactor, rt, 0, 0, 0, tocolor(255, 255, 255, 255)) local rx, ry, rz = getElementRotation(localPlayer) local lB = (15)*xFactor local rB = (15+290)*xFactor local tB = sy-(205)*yFactor local bB = tB + (175)*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) --get position local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) --cap position to screen local dist = getDistanceBetweenPoints2D(cX, cY, bpx, bpy) --get distance to the capped position local bpx, bpy = getPointFromDistanceRotation(cX, cY, dist, rot) --re-calculate position based on new distance if bpx and bpy then --if position was obtained successfully local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) --cap position just in case 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('onClientClick', getRootElement(), function(button, state, cursorX, cursorY) if (not isPlayerMapVisible()) then local cursorX, cursorY = getCursorPosition(); if (button == 'left' and state == 'down') then if (cursorX >= xFactor and cursorX <= xFactor + worldW and cursorY >= yFactor and cursorY <= yFactor + worldH) then isMoving = true; movingOffsetX = cursorX - xFactor; movingOffsetY = cursorY - yFactor; end else isMoving = false; end end end ) No errors/warnings in debugscript 3, what the problem with this?
-
now the radar "move" but... not the way I want it bug video: this is the code: local movingOffsetX, movingOffsetY = 0, 0 local isMoving = false bindKey('m', 'down', function() showCursor(not isCursorShowing()); end ) function drawRadar() showPlayerHudComponent("radar", false) if disableGTASAhealth then showPlayerHudComponent("health", false) end if disableGTASAarmor then showPlayerHudComponent("armour", false) end if disableGTASAoxygen then showPlayerHudComponent("breath", false) end if (not isPlayerMapVisible()) then if (isCursorShowing() and isMoving) then local cursorX, cursorY = getCursorPosition(); cursorX = cursorX * sx; cursorY = cursorY * sy; xFactor = cursorX - movingOffsetX; yFactor = cursorY - movingOffsetY; end 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(xFactor, yFactor, worldW, worldH, 0xFF5E656B) dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "image/world.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) end dxSetRenderTarget() dxDrawRectangle((10)*xFactor, sy-((200+10))*yFactor, (300)*xFactor, (184)*yFactor, tocolor(0, 0, 0, 175)) dxDrawImage((10+5)*xFactor, sy-((200+5))*yFactor, (300-10)*xFactor, (175)*yFactor, rt, 0, 0, 0, tocolor(255, 255, 255, 255)) local rx, ry, rz = getElementRotation(localPlayer) local lB = (15)*xFactor local rB = (15+290)*xFactor local tB = sy-(205)*yFactor local bB = tB + (175)*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) --get position local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) --cap position to screen local dist = getDistanceBetweenPoints2D(cX, cY, bpx, bpy) --get distance to the capped position local bpx, bpy = getPointFromDistanceRotation(cX, cY, dist, rot) --re-calculate position based on new distance if bpx and bpy then --if position was obtained successfully local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) --cap position just in case 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('onClientClick', getRootElement(), function(button, state, cursorX, cursorY) if (not isPlayerMapVisible()) then if (button == 'left' and state == 'down') then if (cursorX >= xFactor and cursorX <= xFactor + worldW and cursorY >= yFactor and cursorY <= yFactor + worldH) then isMoving = true; movingOffsetX = cursorX - xFactor; movingOffsetY = cursorY - yFactor; end else isMoving = false; end end end ) how to fix this bug?
-
local movingOffsetX, movingOffsetY = 0, 0 local isMoving = false bindKey('m', 'down', function() showCursor(not isCursorShowing()); end ) function drawRadar() showPlayerHudComponent("radar", false) if disableGTASAhealth then showPlayerHudComponent("health", false) end if disableGTASAarmor then showPlayerHudComponent("armour", false) end if disableGTASAoxygen then showPlayerHudComponent("breath", false) end if (not isPlayerMapVisible()) then if (isCursorShowing() and isMoving) then local cursorX, cursorY = getCursorPosition(); cursorX = cursorX * sx; cursorY = cursorY * sy; xFactor = cursorX - movingOffsetX; yFactor = cursorY - movingOffsetY; end 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(xFactor, yFactor, worldW, worldH, 0xFF5E656B) dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "image/world.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255)) end dxSetRenderTarget() dxDrawRectangle((10)*xFactor, sy-((200+10))*yFactor, (300)*xFactor, (184)*yFactor, tocolor(0, 0, 0, 175)) dxDrawImage((10+5)*xFactor, sy-((200+5))*yFactor, (300-10)*xFactor, (175)*yFactor, rt, 0, 0, 0, tocolor(255, 255, 255, 255)) local rx, ry, rz = getElementRotation(localPlayer) local lB = (15)*xFactor local rB = (15+290)*xFactor local tB = sy-(205)*yFactor local bB = tB + (175)*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) --get position local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) --cap position to screen local dist = getDistanceBetweenPoints2D(cX, cY, bpx, bpy) --get distance to the capped position local bpx, bpy = getPointFromDistanceRotation(cX, cY, dist, rot) --re-calculate position based on new distance if bpx and bpy then --if position was obtained successfully local bpx = math.max(lB, math.min(rB, bpx)) local bpy = math.max(tB, math.min(bB, bpy)) --cap position just in case 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('onClientClick', getRootElement(), function(button, state, cursorX, cursorY) if (not isPlayerMapVisible()) then local cursorX, cursorY = getCursorPosition(); if (button == 'left' and state == 'down') then if (cursorX >= xFactor and cursorX <= xFactor + worldW and cursorY >= yFactor and cursorY <= yFactor + worldH) then isMoving = true; movingOffsetX = cursorX - xFactor; movingOffsetY = cursorY - yFactor; end else isMoving = false; end end end ) why not move the radar? i do not get errors/warnings in debugscript 3 and i don't know what wrong..
-
I downloaded this radar: https://community.multitheftauto.com/index.php?p=resources&s=details&id=10673 And how can i make this movable? For example, i press F5 button on my keyboard, and the radar become movable, and when i press F5 again, the radar again can not be moved. How to? Sorry, for my very-very bad english!
-
i want create a cool radar for mta, but i don't know, how to make a radar I do not want blips, just localplayer, and otherplayers blip. how to create? sorry for my very bad english
-
i got this warning, and error: "rC.lua:40: bad argument @ 'dxDrawImageSection' [Expected material at argument 9, got nil]" - This is the warning msg.. "sC.lua:6: attempt to index global 'WorldRadar' (a nil value)" - This is the error msg.... And code(s): rC.lua:40: - dxDrawImageSection(WorldRadar["monX"], WorldRadar["monY"], WorldRadar["width"], WorldRadar["height"], mapX + 50, mapY + 60, WorldRadar["width"]/zoom, WorldRadar["height"]/zoom, WorldRadar["Map"], 0, 0, 0, tocolor(255, 255, 255, 255)) --- and the sC:lua:6: - Map = {} Map["F11"] = false function Map.start() MiniMap.start() WorldRadar.start() end Map.start() function Map.draw() if Map["F11"] then return end MiniMap.draw() end addEventHandler("onClientRender", root, Map.draw) function Map.stop() end What wrong? How to fix this problems? Thanks the help!
-
I want a good radar to my server, but i cannot find. And I searched on community, but i cannot find good too.. Anyone can send me a website, or anything from where can i download good radar(s)? Thank you!
-
i have a radar script, with "showPlayerHudComponent("radar", false)" but the radar, when change map will show again, why? how to fix? Race gamemode!
-
so i saw in a server when i got into hydra i got to see all the targets what resource is this can someone tell me please?
-
function North () local north = createBlipAttachedTo ( north, 4 ); dxDrawImage(north, 20, 20, 'files/images/blips/north.png', 0, 0, 0, tocolor(0, 0, 0, 255), false); end i tried this, but doesn't working. how to add north blip to a radar script?