pepsi18 Posted April 23, 2014 Share Posted April 23, 2014 I am using this radar community as might make the map does not repeat at the end of the entire map help plis local s = {guiGetScreenSize()} local icons = {} for k = 1,65 do icons[k] = dxCreateTexture("blips/"..k..".png") end local blips = {} addEventHandler( "onClientResourceStart", getRootElement( ),function (res) if res ~= getThisResource() then return end radarTexture = dxCreateTexture("sattelite.png", 'dxt5', true, 'clamp' ) currentZoomState = 0.8 local width, height = 1200,1200 radar = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900 ) mapRadar = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900,true ) radararea = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900,true ) pathmap = dxCreateRenderTarget( s[1]*width*3/1440, s[2]*height*3/900,true ) local MimgW,MimgH = dxGetMaterialSize(mapRadar) setTimer(function () blips = {} for i, v in ipairs( getElementsByType('blip') ) do local icon = getBlipIcon(v) if icon > 3 then local px,py = getElementPosition(v) local blip_x = (3000+px)/6000*MimgW local blip_y = (3000-py)/6000*MimgH local rot = getPedCameraRotation( localPlayer ) table.insert(blips,{x = blip_x, y = blip_y,icon = icon}) end end end,10000,0) addEventHandler ("onClientPreRender",root, function () dxSetRenderTarget( mapRadar,true ) dxDrawImage (0,0,MimgW,MimgH, radarTexture) for i, v in ipairs( blips ) do local rot = getPedCameraRotation( localPlayer ) dxDrawImage(v.x-20/2, v.y-20/2, 20, 20,icons[v.icon],rot) end for i, v in ipairs(getElementsByType('player') ) do if v ~= localPlayer then local r,g,b = 20,200,20 or getPlayerNametagColor(v) local px,py = getElementPosition(v) local p_x = (3000+px)/6000*MimgW local p_y = (3000-py)/6000*MimgH local prot = getPedRotation( v ) local p_blipsize = 20-currentZoomState dxDrawImage (p_x-p_blipsize/2,p_y-p_blipsize/2,p_blipsize,p_blipsize, icons[3],-prot,0,0,tocolor(r,g,b)) end end dxSetRenderTarget( ) dxSetRenderTarget( radararea,true ) for i, v in ipairs( getElementsByType('radararea') ) do local r,g,b,a = getRadarAreaColor(v) local w,h = getRadarAreaSize(v) x,y = getElementPosition(v) x = x / (6000 / MimgW) + MimgW/2 y = y / (-6000/ MimgH) + MimgH/2 dxDrawRectangle(x, (y-h) + 4 + (h/2), (w/2), (h/2), tocolor(r,g,b,a)) end dxSetRenderTarget( ) dxSetRenderTarget( radar,true ) local x,y,z = getElementPosition(localPlayer) local rot = getPedCameraRotation( localPlayer ) local mapx = x / (6000/MimgW) + MimgW/2 - width*currentZoomState/2 local mapy = y / (-6000/MimgH) + MimgH/2 - height*currentZoomState/2 dxDrawImageSection (0,0,width,height,mapx,mapy,width*currentZoomState,height*currentZoomState,mapRadar,-rot) dxDrawImageSection (0,0,width,height,mapx,mapy,width*currentZoomState,height*currentZoomState,radararea,-rot) dxDrawImageSection (0,0,width,height,mapx,mapy,width*currentZoomState,height*currentZoomState,pathmap,-rot) local px,py = getElementPosition(localPlayer) local prot = getPedRotation( localPlayer ) local pblipsize = 20 - currentZoomState dxDrawImage (width/2-pblipsize/2,height/2-pblipsize/2,pblipsize,pblipsize, icons[3],-rot-prot) dxSetRenderTarget() showPlayerHudComponent("radar",false) dxDrawImageSection(s[1]*50/1440, s[2]*650/900, s[1]*300/1440, s[2]*200/900, 450,490, 300, 200,radar, 0, -90, 0, tocolor(255, 255, 255, 255),true) dxDrawRectangle(s[1]*50/1440, s[2]*650/900,s[1]*300/1440,s[2]*2/900,tocolor(0,0,0,255),true) dxDrawRectangle(s[1]*50/1440, s[2]*850/900,s[1]*300/1440,s[2]*2/900,tocolor(0,0,0,255),true) dxDrawRectangle(s[1]*350/1440, s[2]*650/900,s[1]*2/1440,s[2]*202/900,tocolor(0,0,0,255),true) dxDrawRectangle(s[1]*50/1440, s[2]*650/900,s[1]*2/1440,s[2]*200/900,tocolor(0,0,0,255),true) local x,y,z = getElementPosition(localPlayer) local zone = getZoneName(x,y,z) local textwidth = dxGetTextWidth(zone, 1.02,"default-bold") dxDrawRectangle(s[1]*50/1440, s[2]*820/900,s[1]*(textwidth+25)/1440,s[2]*30/900,tocolor(0,0,0,120),true) dxDrawText ( zone, s[1]*63/1440, s[2]*828/900,s[1]*(textwidth+25)/1440,s[2]*30/900, tocolor ( 255, 255, 255, 255 ), 1.02, "default-bold", "left", "top",false,false,true,false,true, 0,0,0) if getKeyState("num_add") then if currentZoomState - 0.01 < 0.5 then return else currentZoomState = currentZoomState - 0.03 end elseif getKeyState("num_sub") then if currentZoomState + 0.01 > 1.5 then return else currentZoomState = currentZoomState + 0.03 end 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