RenanPG Posted March 3, 2014 Share Posted March 3, 2014 hi everybody, i've made a radar in gta v style, but i don't know how to put blips there. And i need help to makes radar image rotate. Link to comment
TrapLord Studios™ Posted March 3, 2014 Share Posted March 3, 2014 I don't know if you are using the same MTA radar functions or you created your own.. Did you create your own? Link to comment
RenanPG Posted March 4, 2014 Author Share Posted March 4, 2014 yes i created my own, using dxDrawImageSection. Link to comment
Bonsai Posted March 4, 2014 Share Posted March 4, 2014 I remember there was a very similar topic before, since I replied there. Go search for it. It contains everything you need to get this done. Link to comment
RenanPG Posted March 4, 2014 Author Share Posted March 4, 2014 this viewtopic.php?f=91&t=71784&hilit=blip ??? but some codes were removed ;( if someone want to help me, i can send my current codes by pm. Link to comment
Bonsai Posted March 4, 2014 Share Posted March 4, 2014 No Idea why that weird guy removed all the code that might help others.. But still, there a plenty of other topics. And you could also try to do it on your own, its not that hard, just some testing needed. Link to comment
Moderators Citizen Posted March 4, 2014 Moderators Share Posted March 4, 2014 Well, your whole code isn't needed but I would like to see how you are calculating the x and y for the dxDrawImageSection Also, what is the size of the radar map image ? 3000x3000 ? 6000x6000 ? Thanks Link to comment
RenanPG Posted March 4, 2014 Author Share Posted March 4, 2014 local px = ((x + 6000) / 2) - 100 local py = ((-y + 6000) / 2) - 100 The whole image is 6000x6000. here is my map. if x >= -3200 then if x <= 3200 then if y >= -3200 then if y <= 3200 then imagem = "mapa.jpg" else imagem = "agua.png" end else imagem = "agua.png" end else imagem = "agua.png" end else imagem = "agua.png" end and i use that to replace txture when the player is in middle of the sea. that makes the map infinite. Link to comment
Bonsai Posted March 4, 2014 Share Posted March 4, 2014 Maybe this helps you, might be a bit tricky since its not the whole code of my radar, but maybe this gives you a basic idea of how you could do it. 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 ) ) --Convert to degrees rotx = math.deg(rotx) rotz = math.deg(rotz) return rotz end 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 if getPedOccupiedVehicle(localPlayer) ~= false then theVehicle = getPedOccupiedVehicle(localPlayer) elseif getCameraTarget(localPlayer) ~= false then theVehicle = getCameraTarget(localPlayer) else return end local rotation = getCameraRotation() for i, p in pairs(getClientPlayersInArena(arenaElement)) do if getElementData(p, "state") == "Alive" then if getPedOccupiedVehicle(p) and getPedOccupiedVehicle(p) ~= theVehicle then local x, y, z = getElementPosition(getPedOccupiedVehicle(p)) local name = getPlayerName(p) local c1, c2 = string.find(name, '#%x%x%x%x%x%x') if c1 then blipr, blipg, blipb = getColorFromString(string.sub(name, c1, c2)) else blipr = 255 blipg = 255 blipb = 255 end local distance = getDistanceBetweenPoints2D(x, y, lx,ly) local rotation2 = findRotation(x,y,lx,ly) local , yd = getPointFromDistanceRotation(startwidth+(width/2), startheight+(height/2), distance/3.3, rotation2-rotation) if < startwidth+edgeVertical then = startwidth+edgeVertical elseif > startwidth+width-edgeVertical then = startwidth+width-edgeVertical end if yd < startheight+edgeVertical then yd = startheight+edgeVertical elseif yd > startheight+height then yd = startheight+height end dxDrawRectangle ( -4, yd-4, 8, 8, tocolor ( 0, 0, 0, 255 ) ) dxDrawRectangle (-3, yd-3, 6, 6, tocolor (blipr, blipg, blipb, 255 ) ) end end 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