Jump to content

[ Help ] Radar


dsmatias

Recommended Posts

Hello, I have a radar on my server when I'll turn it does not appear, someone help me?

local screenW,screenH = guiGetScreenSize()
local resW,resH = 1366,768
local sW,sH =  (screenW/resW), (screenH/resH)

    local turn = true
    local alpha = 255
	
addEventHandler( "onClientResourceStart", resourceRoot,
	function()
	    setPlayerHudComponentVisible ( "radar", false )
		--# Create Textures
        hudMaskFX = dxCreateShader("mask.fx")
		radarTexture = dxCreateTexture("img/map.png")
		maskTexture = dxCreateTexture("img/radar_mask.png")
		checkTextures = ( hudMaskFX and radarTexture and maskTexture )

		if not ( checkTextures ) then
			outputChatBox( "[Arma II DayZ Radar]: Could not create textures. Please use debugscript 3" )
		else
			dxSetShaderValue( hudMaskFX, "sPicTexture", radarTexture )
			dxSetShaderValue( hudMaskFX, "sMaskTexture", maskTexture )
		end
	end
)

    function drawRadar()
		if not ( checkTextures ) then return end
	        dxSetShaderValue( hudMaskFX, "sMaskTexture", maskTexture )
		
		local x,y = getElementPosition( localPlayer )
		local zoom = 13		
		    x = ( x ) / 6000
		    y = ( y ) / -6000
		dxSetShaderValue( hudMaskFX, "gUVPosition", x,y )
		dxSetShaderValue( hudMaskFX, "gUVScale", 1/zoom, 1/zoom )

        --# Get rotations
		local _, _, c_Rot = getElementRotation( getCamera());
		local _, _, p_Rot = getElementRotation( localPlayer )		
		    dxSetShaderValue( hudMaskFX, "gUVRotAngle", math.rad( -c_Rot ))			
		
		if getElementData(getLocalPlayer(),"GPS") >= 1  then
		setPlayerHudComponentVisible ( "radar", false )
		--# Alpha
		--dxDrawRectangle(23.5*sW, 676.5*sH, 130.5*sW, 9.2*sH, HP_Alpha)		
		--dxDrawRectangle(156.6*sW, 676.5*sH, 65*sW, 9.2*sH, tocolor(0, 102, 255, 100))
        --dxDrawRectangle(225*sW, 676.5*sH, 62.6*sW, 9.2*sH, tocolor(255, 255, 0, 100))
		
		--# Bars
		--dxDrawRectangle(23.5*sW, 676.5*sH, 130.5*sW/maxHealth*playerHealth, 9.2*sH, HP_Colour)		
        --dxDrawRectangle(156.6*sW, 676.5*sH, 65*sW/100*playerArmor, 9.2*sH, tocolor(0, 102, 255, 190))
        --dxDrawRectangle(225*sW, 676.5*sH, 62.6*sW/1000*playerOxygen, 9.2*sH, tocolor(255, 255, 0, 190))			 
		
		--# Minimap		x,y,w,h 21
       -- dxDrawImage(-6*sW, 500*sH, 300*sW, 250*sH, "img/radar_cover.png", 0, 0, 0, tocolor(255, 255, 255, 255))
	 dxDrawImage(0*sW, 592*sH, 216*sW, 183*sH, "img/radar_cover.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
        dxDrawImage(0*sW, 598*sH, 197*sW, 125*sH, hudMaskFX, 0,0,0, tocolor(255,255,255,255))
        dxDrawImage(90*sW, 655*sH, 21*sW, 21*sH, "img/radar_player.png", -p_Rot+c_Rot, 0, 0, tocolor(200, 200, 200, 200))
		end

		--# Wanted
		local g_wl = getPlayerWantedLevel( localPlayer )
        if ( g_wl > 0 ) then
            if ( turn == true ) then
                alpha = alpha + 5
                    if ( alpha > 180 ) then
                        alpha = 180
                        turn = false
        end
        elseif ( turn == false ) then
            alpha = alpha - 5
                if ( alpha < 0 ) then
                    alpha = 0
                    turn = true
                end
        end
        --dxDrawRectangle(23*sW, 536*sH, 265*sW, 135*sH, tocolor(0, 102, 255, alpha))
        else return end		
		end
addEventHandler( "onClientRender", root, drawRadar)

addEventHandler( "onClientResourceStop", resourceRoot,
	function()
	    setPlayerHudComponentVisible ( "radar", true )
	end)

 

Link to post

not even the warn text?

"[Arma II DayZ Radar]: Could not create textures. Please use debugscript 3"

^ if this appears, it means that the script works but not for you.

If it doesn't, this means the script failed.

And I want to make sure that you are aware that this minimap will only work on DayZ gamemode? this means try to set your "gps" data to 1 or something greater to see that gps.

( you need a gps item in dayz inorder to this to appear )

Link to post

yeah it is probably this since he is using masks.

Not sure if you understood me, but my last tip is to do the following;

1.start the radar from admin panel.

2. start runcode from admin panel

3. run this code on the F8 console;

srun setElementData(getPlayerFromName("yourname"),"GPS",1)

NOTE: "yourname" means you have to write your name inside the quotation marks  " ". so if your in-game name was 'Noob' it will look this way;

srun setElementData(getPlayerFromName("Noob"),"GPS",1).

 

  • Like 1
Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...