Hello, Here is the way I would have begin (tested in-game). Hope it can help.
local screenW, screenH = guiGetScreenSize()
local map_w = 1536 -- size of the map image (mine is 1536 x 1536)
local game_w = 6000 -- equivalency with the game size (here whole gtasa map = 6000 x 6000)
local radar_w = 400 -- size of the radar on screen
local rt = dxCreateRenderTarget(map_w , map_w) -- same size of the map image
addEventHandler("onClientRender", root, function()
local x_game, y_game = getElementPosition(localPlayer) -- game positions of the player
local x_map = (map_w * (x_game + 3000)) / game_w -- scale the x to map's resolution
local y_map = -(map_w * (y_game + 3000)) / game_w -- scale the y to map's resolution
-- player in-game position will be -3000 to +3000 for both axes, so I add +3000 to have proper relation between game size and map size
-- I add a negative value to y_map. If not, the map will move in the wrong direction for Y axe (inverted)
dxSetRenderTarget(rt,true)
dxDrawImageSection(0, 0, map_w, map_w, x_map - (radar_w / 2), y_map - (radar_w / 2), radar_w, radar_w, "map.jpg")
-- first it draws the whole map (0,0 to map_w, map_w).
-- the section will be the size you want for the radar less the mid-distance to place the x, y player position to the center
dxDrawCircle(map_w / 2, map_w / 2, 30) -- some circle drawn in the middle which symbolize the main player
dxSetRenderTarget()
dxDrawImage(screenW/2 - radar_w/2, screenH/2 - radar_w/2, radar_w, radar_w, rt);
end
)
Have a nice day.