Jump to content

Radar GTA 5 STYLE


yoya99

Recommended Posts

Posted

hey guys ...i haev ragesgta 5 hud but how to maek playerblips on it seen? :/ i dont see any players thats very poor because it the best hud on community.i guess nothign is added from playerblips in this code :''(

here is the code:

--[[ 
    # Resource Name 
      Grand Theft Auto V | Radar 
    # Author 
      Rage 
    # Date created 
      25.04.2014 
    # Last update 
      17.07.2014     
    # Copyright (c) 
      If you edit it, then please respect me and keep 
      the credits. 
--]] 
  
local screenW,screenH = guiGetScreenSize() 
local resW,resH = 1280,720 
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/radar_map.jpg") 
        maskTexture = dxCreateTexture("img/radar_mask.png") 
        checkTextures = ( hudMaskFX and radarTexture and maskTexture ) 
  
        if not ( checkTextures ) then 
            outputChatBox( "[GTA V 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 )) 
         
        local playerHealth = math.floor( getElementHealth( localPlayer )) 
        local playerArmor = math.floor( getPedArmor( localPlayer )) 
        local playerOxygen = math.floor( getPedOxygenLevel( localPlayer )) 
            if ( playerHealth  <= 50) then 
                HP_Colour = tocolor(200, 0, 0, 190) 
                HP_Alpha = tocolor(200, 0, 0, 100) 
            else 
                HP_Colour = tocolor(102, 204, 102, 190) 
                HP_Alpha = tocolor(102, 204, 102, 100)               
            end 
            if ( playerHealth >= 101 ) then 
                maxHealth = 200 
            else 
                maxHealth = 100 
            end              
         
        --# 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      
        dxDrawImage(18*sW, 530*sH, 275*sW, 160*sH, "img/radar_cover.png", 0, 0, 0, tocolor(255, 255, 255, 255)) 
        dxDrawImage(23*sW, 536*sH, 265*sW, 135*sH, hudMaskFX, 0,0,0, tocolor(255,255,255,210)) 
        dxDrawImage(144*sW, 595*sH, 20*sW, 20*sH, "img/radar_player.png", -p_Rot+c_Rot, 0, 0, tocolor(255, 255, 255, 255)) 
  
        --# 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( "onResourceStop", resourceRoot, 
    function() 
        setPlayerHudComponentVisible ( "radar", true ) 
    end) 

Posted

I have an example from Xiti's work but I don't have permission to share it. You don't even understand the differnece between client and server side so something like this would be impossible for you.

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...